I guess I'm using the windows one from
control panel > Administrative Tools > Internet Information Services.
In fact the code in the snippet works perfectly fine for me.
Am I missing something?
Main Topics
Browse All TopicsHi,
I am getting an error while trying to send an automatic email notification through my IIS.
PHP.ini is set to: -
SMTP =localhost
smtp_port = 25
; For Win32 only.
;sendmail_from = me@example.com
See code snippet below:
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
First, check the differences between line 7 of your working code snippet, and line 12 of your original code. To help, here's the function header for mail():
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
Also, line 1 of your original code does not include quotes around the string. Perhaps that is just a typo in the post, though...?
Otherwise, what is the exact error you are receiving?
Never mind...your headers are in the correct order.
The error you are receiving implies that the mail server either a) cannot deliver to the requested address or b) you are attempting to send from an unauthorized address. I'm looking at (b) because of the ini snippet you posted originally:
>>> ; For Win32 only.
>>> ;sendmail_from = me@example.com
That sendmail_from should be set for Windows servers, or set in the "From" headers of the mail() call. Your header, as built in the code, will look like this:
"Me<xyz@gmail.com>"
At the very least, you need a space between them.
"Me <xyz@gmail.com>"
That assumes your mail server will recognize that format. I would recommend setting the ini value to "xyz@gmail.com", and testing that first.
OK I found one problem.... The script in the package downloaded had a small bug. The path to the included files was incorrect. Now I fixed that and got this error message:
Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in c:\Inetpub\wwwroot\phpMail
SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (40) Mailer Error: SMTP Error: Could not connect to SMTP host.
gmail uses ssl on smtp su you need ssl support in php:
enable openssl.dll in php.ini and copy required dll in %SYSTEMROOT%\system32\ folder
and windows doesn't have sendmail. this is the reason you MUST use smtp to send mail on windows.
for other free smtp servers for windows you could try:
http://www.softstack.c
i haven't used php ond windows for quite some time, but this above should work as expected ( remember to turn off IIS SMTP off before installing other one)
Thanks,
That's great! I managed to use all scripts - only one I didn't manage to use from my localhost; the test_mail.php. Seems I got some problems with the IIS SMTP server. Still strange though, because the test_smtp.php worked from my localhost.
However I think I read somewhere that the test_mail.php is slower than the others. Am I correct?
Business Accounts
Answer for Membership
by: dereshPosted on 2008-10-06 at 12:35:10ID: 22653567
dou you have localy (on server with iis) installed smtp/mail server. you need one if you intend to send mails through it ;)
for windows you have many free smtp servers which you could use.