Hello Folk,
I looked around and really didn't find an answer for this specific problem. I'm a.NET guy that is trying to help out a fellow PHP guy rebuild a web app from vb.net to PHP. Send mail in .NET works correctly using the virtual SMTP server in IIS 6. But when trying to send a mail using PHP 5.2.3 there seems to be nothing happening.
I've executed the php_info() method which shows the follow for the mail specific values:
mail.force_extra_parameters no value no value
sendmail_from no value no value
sendmail_path no value no value (I understand this one is not used in win enviorments)
SMTP localhost localhost
smtp_port 25 25
Internal Sendmail Support for Windows enabled
I looked in the php.ini and noticed that sendmail_from was set to a generic value even though php_info() shows it as not set (which I read is a common problem)
I did some other searching on the web and I found this:
if (!mail($To, $Subject, $Msg, "From:\t$From\r\n"."Reply-To:\t$From\r\n"))
{
echo "mail() did not succeed";
}
else
{
echo "mail() executed correctly.";
}
Which returns a "not succeed" message. Any help would be appreciated. Keep in mind I'm not a PHP guy so a bit extra explanation would be appreciated.
Thanx in advance,
Peter
PHP not sending email on W2K Box with IIS STMP installed
Moderator: General Moderators
Re: PHP not sending email on W2K Box with IIS STMP installed
a silly question maybe, but is the SMTP server still running without .net ?
PHP would require some sort of mail server to talk to.
PHP would require some sort of mail server to talk to.
Re: PHP not sending email on W2K Box with IIS STMP installed
Thank you very much for your reply.
Yup, SMTP is running, I have tested that is does relay properly from outside of the application. btw, slight correct, this is W2K3, not 2000.
I also tried the "ini_set()" to overwrite any variables that may be incorrect, no luck. The odd thing is that it seems as though mail() is not working at all, I can give it s valid host with that allows relay and it still returns unsuccessful. Is there any way to test if the mail() object is valid? If this even posible?
Yup, SMTP is running, I have tested that is does relay properly from outside of the application. btw, slight correct, this is W2K3, not 2000.
I also tried the "ini_set()" to overwrite any variables that may be incorrect, no luck. The odd thing is that it seems as though mail() is not working at all, I can give it s valid host with that allows relay and it still returns unsuccessful. Is there any way to test if the mail() object is valid? If this even posible?
Re: PHP not sending email on W2K Box with IIS STMP installed
mail() has its own checking, and return true/false accordingly.
if you want to check the object it means going into the mail wrapper class.
messy way to debug. also it is widely used and is very likely reliable.
can't help you with this instant you are facing, but i can report i have had good success
with Apache and PostCastServer (http://www.postcastserver.com/, they have a free version)
on an XP.
how this compares with IIS server and its own SMTP i would not know, sorry.
hope the info i gave is of some use.
if you want to check the object it means going into the mail wrapper class.
messy way to debug. also it is widely used and is very likely reliable.
can't help you with this instant you are facing, but i can report i have had good success
with Apache and PostCastServer (http://www.postcastserver.com/, they have a free version)
on an XP.
how this compares with IIS server and its own SMTP i would not know, sorry.
hope the info i gave is of some use.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: PHP not sending email on W2K Box with IIS STMP installed
Take a look at swiftmailer.org, it can provide some debugging information as to why your mail() call is failing. PHP's mail() function is notoriously bad and should generally be avoided.