barnes Posted May 3, 2007 Share Posted May 3, 2007 Hi to all, i need some help about e mail sending.i am basic learner of php. <?php $to="[email protected]"; $subject="test mail"; $message="hello!shyam this is sample mail to you."; $from="[email protected]"; $headers="From:$from"; mail($to,$subject,$message,$headers); echo "mail sent"; ?> when i run this script i got following errors.how to fix these problems. Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:\easyphp1-8\www\mail.php on line 7 i am working on local host.i opened php.ini and saw this SMTP and smtp_port variable.please any one explain all modification in php.ini and reqiurements to send a mail. Link to comment https://forums.phpfreaks.com/topic/49751-mail-function-help/ Share on other sites More sharing options...
jitesh Posted May 3, 2007 Share Posted May 3, 2007 In php.ini check this [mail function] ; For Win32 only. SMTP = host ; for Win32 only smtp_port = 25 sendmail_from= [email protected] ; for Win32 only ------------------------------------------------ Better to user phpmailer for smtp mails. Link to comment https://forums.phpfreaks.com/topic/49751-mail-function-help/#findComment-244026 Share on other sites More sharing options...
barnes Posted May 3, 2007 Author Share Posted May 3, 2007 Hi jitesh.thanks for fast resopnse..it's same as in php.ini Link to comment https://forums.phpfreaks.com/topic/49751-mail-function-help/#findComment-244029 Share on other sites More sharing options...
jitesh Posted May 3, 2007 Share Posted May 3, 2007 Refer this attached library to send mail and README [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/49751-mail-function-help/#findComment-244033 Share on other sites More sharing options...
barnes Posted May 3, 2007 Author Share Posted May 3, 2007 in php.ini SMTP = localhost but ur wrote SMTP=host.i s there any problem with SMTP variable. Link to comment https://forums.phpfreaks.com/topic/49751-mail-function-help/#findComment-244035 Share on other sites More sharing options...
jitesh Posted May 3, 2007 Share Posted May 3, 2007 Better to use phpmailer library attached above. Check its readme with example. Link to comment https://forums.phpfreaks.com/topic/49751-mail-function-help/#findComment-244037 Share on other sites More sharing options...
barnes Posted May 3, 2007 Author Share Posted May 3, 2007 okay .i downloaded.i saw this class.phpmail.php,but still same problem occuring.i need to know about changes in php.ini to send a mail from local system.it needs any smtp details.. Link to comment https://forums.phpfreaks.com/topic/49751-mail-function-help/#findComment-244044 Share on other sites More sharing options...
jitesh Posted May 3, 2007 Share Posted May 3, 2007 check your smtp host,smtp username and smtp passsword are correct. Link to comment https://forums.phpfreaks.com/topic/49751-mail-function-help/#findComment-244049 Share on other sites More sharing options...
corbin Posted May 3, 2007 Share Posted May 3, 2007 Ummm first off let's make sure you can connect to your mail server.... Hit start->run then type "cmd" no quotes type "telnet localhost 25" no quotes and see if it connects.... If it doesn't then it's a problem with your mail server ;p. (PS telnet doesn't come installed with Vista) Link to comment https://forums.phpfreaks.com/topic/49751-mail-function-help/#findComment-244051 Share on other sites More sharing options...
barnes Posted May 3, 2007 Author Share Posted May 3, 2007 how to check this SMTP detilas..how can i get this smtp details.. Link to comment https://forums.phpfreaks.com/topic/49751-mail-function-help/#findComment-244054 Share on other sites More sharing options...
barnes Posted May 3, 2007 Author Share Posted May 3, 2007 Hi corbin, i run ur command in command prompt.it dispalys could not to mail server.how can i get SMTP details..and how can i get port number. Link to comment https://forums.phpfreaks.com/topic/49751-mail-function-help/#findComment-244057 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.