mail() using Windows SMTP Service

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

mail() using Windows SMTP Service

Post by anjanesh »

Im using PHP 5.1.1 + Apache 2.0.55 on Win XP Pro also having IIS 5.1 with Windows SMTP Service running.
In phpinfo(),
Internal Sendmail Support for Windows : Enabled

Code: Select all

SMTP localhost localhost
smtp_port 25 25
How do I get the mail function to work ?

I get

Code: Select all

Warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address in C:\xxx\mail.php on line 21
Thanks
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

The mail function does work.
It's your SMTP server that complains that you've used an invalid address...

Thus, feed it with valid addresses or configure your smtpd to accept the address...
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

My IIS is running on localhost:81
So I changed SMTP settings in php.ini

Code: Select all

[mail function]
; For Win32 only.
SMTP = localhost:81
smtp_port = 25
Now I get

Code: Select all

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost:81" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xxx\mail.php on line 21
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Changed port from 25 to 587 - in php.ini and in Windows SMTP Service settings.

Now I get

Code: Select all

Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for recipient@domain.com in C:\xxxmail.php on line 21
EDIT : I got it working - but all the EML files are in C:\Inetpub\mailroot\Queue and no mail has been sent so far.
Post Reply