Why doesn't this short php script send email?
Posted
by RoryG
on Stack Overflow
See other posts from Stack Overflow
or by RoryG
Published on 2010-06-03T20:58:19Z
Indexed on
2010/06/03
21:04 UTC
Read the original article
Hit count: 200
I can't seem to get my php script to send email.
<?php
echo "Does this page work?";
mail('my email address', 'test subject', 'test message');
?>
First, I have set the mail function settings in the php.ini file as follows:
I checked my email account settings on outlook. It does not require authentication, its port is 25, and its type of encrypted connection is 'Auto'. Given this I configured my php.ini file accordingly:
SMTP = ssl://smtp1.iis.com
smtp_port = 25
Then I set:
sendmail_from: my email address
The echo statement prints out in the browser, so I know the php file is recognized and processed. But the browser also shows the following error:
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\mailtest.php on line 3
I have clearly set the sendmail_from so I don't know what else to do. I have also tried removing the 'ssl://' part from the SMTP setting in the php.ini file, and configuring the php5.ini file. Which of these .ini files should I be configuring anyways?
© Stack Overflow or respective owner