magic8ball Posted November 4, 2009 Share Posted November 4, 2009 I am using WAMP (Windows Apache/PHP/MySQL) on a Windows XP desktop. I am trying to use the PHP mail() function to send mail to a remote SMTP server because there is no SMTP daemon/server on my local machine. For example, my desktop is hostname: [bpat.skc.com] The Remote SMTP server is [mail.skc.com] Inside the php.ini I configured ####### SMTP = "mail.skc.com" smtp_port = 25 sendmail_from = "[email protected]" ####### Inside my test file (x.php) I have ========================================== <?php ini_set("SMTP","mail.skc.com"); ini_set("smtp_port","25"); ini_set("sendmail_from","[email protected]"); if (mail("[email protected]","This is a test","This is the body","From: [email protected]\r\nContent-type: text/plain\r\n\r\ n")) { print "Success"; } else { print "Failed"; } ?> ========================================== I have run this testfile on a UNIX server with sendmail that is a known functioning PHP Web server, and it sends the test email correctly. When I use this same test php file on my local WAMP Windows XP Desktop it fails, and the /wamp/logs/apache_error.log show the following: ---------------------------------------- [Wed Nov 04 13:06:51 2009] [error] [client 127.0.0.1] PHP Warning: mail() [<a href='function.mail'>function.mail</a>]: Failed to conn mailserver at "mail.hds.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_in C:\\wamp\\www\\x.php on line 7 ---------------------------------------- I have also tried removing the following section from the above x.php ------------ ini_set("SMTP","mail.skc.com"); ini_set("smtp_port","25"); ini_set("sendmail_from","[email protected]"); ----------- I have verified port 25 is functioning by performing a start -- run -- cmd telnet mail.skc.com 25 Which works correctly. nslookup of mail.skc.com works, as does ping. There is no authentication on the mail.skc.com server, as I have verified by using my corporate email account using Thunderbird and the mail.skc.com that the mail server is functioning for sending and receiving email. Therefore, this leads me to believe it is an issue with the PHP mail() function, or the way I am attempting to make it work. Does anyone have an idea how I can get mail() to work on a Windows Machine w/o a mail server? OR are my only options to run this on an 2003+ Windows server, or install a local SMTP Mail Server? Thanks a lot!!! <?php Magic8Ball();?> Link to comment https://forums.phpfreaks.com/topic/180327-problems-sending-mail-using-php-mail/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.