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 = "someone@example.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "someoneelse@example.com"; $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. Quote Link to comment 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. Quote Link to comment 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... Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.