davey10101 Posted February 27, 2010 Share Posted February 27, 2010 Hi, I'm trying to send email from a php script. I'm using the xampp package and am trying to setup the mercury mail server to send emails but cannot find any tutorials or guides on how to. I was wondering if anyone out there has any experience with this? Here is my script <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Email</title> </head> <body> <?php $to = "root@localhost.com"; $subject = "Hi!"; $body="test"; $body.="Hello World"; $body.="Regards"; $body.="Myself"; $headers = "From: root@localhost.com"; if (mail($to, $subject, $body, $headers)) { echo("Message sent"); } else { echo("Message was not delivered "); } ?> </body> </html> and the php.ini stuff... [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = localhost ; http://php.net/smtp-port smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from ; sendmail_from = postmaster@localhost send_mail_from = root@localhost In Mercury I simply add new user under configurations->manage local users. As a test username is 'root' and password is 'password' when I try and run the script I get this 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:\XXXXX\mailTest.php on line 22 Message was not delivered ...I am then trying to also setup an account in Thunderbird or Windows live mail but it keeps timing out... anyone know how to set this up? cheers 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.