rabbitsfeat Posted February 3, 2008 Share Posted February 3, 2008 Hi everyone, I'm very new to PHP and have started by following the tutorials on w3schools. I'm getting on ok but have run into a problem concerning the email tutorial. See here: http://www.w3schools.com/php/php_mail.asp I've entered this code as they've said: <?php $to = "[email protected]"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "[email protected]"; $headers = "From: $from"; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> And I'm getting this error message: Warning: mail() [function.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:\Program Files\Apache Group\Apache2\htdocs\contact.php on line 27 Mail Sent. I think it has something to do with my PHP setup and an .ini file, but other than that I have no idea! Please can somebody help me? I'm running the apache server on my computer on windows XP Home edition... if that helps. Cheers and hope to be a regular around here as my knowledge of PHP improves. Link to comment https://forums.phpfreaks.com/topic/89281-php-mailfunction/ Share on other sites More sharing options...
KrisNz Posted February 4, 2008 Share Posted February 4, 2008 This just means that you aren't running any mailserver software. The easiest thing to do is to open up php.ini and change the SMTP setting from localhost to your isp's smtp server, i.e smtp.myisp.tld. Then restart apache. Link to comment https://forums.phpfreaks.com/topic/89281-php-mailfunction/#findComment-457160 Share on other sites More sharing options...
rabbitsfeat Posted February 4, 2008 Author Share Posted February 4, 2008 Where do I find php.ini? I follwed the sitepoint video by Kevin Yank to install everything so not sure if in the usual place! Also, how do I find out what my ISP's SMTP server is? Actually I'm not sure if I even have a SMTP setting listed in my php.ini file... Link to comment https://forums.phpfreaks.com/topic/89281-php-mailfunction/#findComment-457167 Share on other sites More sharing options...
ratcateme Posted February 4, 2008 Share Posted February 4, 2008 is the server linux and did you set it up so have full root access then you could configure sendmail to send to your isp's SMTP do you have a email account with your ISP then you can proberly access your ISP SMTP server by SMTP.[isp].com replace [isp] with your isp address AOL would be smtp.aol.com Scott. Link to comment https://forums.phpfreaks.com/topic/89281-php-mailfunction/#findComment-457183 Share on other sites More sharing options...
rabbitsfeat Posted February 4, 2008 Author Share Posted February 4, 2008 Ah I think I've got you! I just did a search around my ISP's site and found that my ISP's SMTP is smtp.blueyonder.co.uk So do I just put that in php.ini where it currently has localhost? Just in the one place yeah? Thank you so much for your help. Link to comment https://forums.phpfreaks.com/topic/89281-php-mailfunction/#findComment-457189 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.