Richard Korts
asked on
php mail fails
See attached, a fairly simple php script to send an email. Nothing is sent.
I put echo's into the code to show what's going on. The result is in the image file.
Note that "ret" is the return value from the mail function, there is no value, so I assume it's failing.
You can try it at www.whasocal.org/send_message.php
What's wrong?
msg-send.php
msg-send-echos.jpg
I put echo's into the code to show what's going on. The result is in the image file.
Note that "ret" is the return value from the mail function, there is no value, so I assume it's failing.
You can try it at www.whasocal.org/send_message.php
What's wrong?
msg-send.php
msg-send-echos.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It appears that @requeue hit the nail on the head.
If I don't put myself in Carbon Copy, the mail is delivered to the mailing subsytem (a final "1" is printed).
Still, that does not ensure the mail is actually delivered to recipient(s). See mail function.
Also, your mailing configuration can use SMTP or sendmail, depending on your hosting. I suggest you put up a script with the following single line:
And see what you have.
If I don't put myself in Carbon Copy, the mail is delivered to the mailing subsytem (a final "1" is printed).
Still, that does not ensure the mail is actually delivered to recipient(s). See mail function.
Also, your mailing configuration can use SMTP or sendmail, depending on your hosting. I suggest you put up a script with the following single line:
<?php phpinfo(); ?>
And see what you have.
If you don't have access to the php.ini file on the server, you might be able to do ini_sets to specify your own smtp and other settings needed by the mail()
For example:
ini_set ( sendmail_from, "my_email@my_server.com" );
ini_set( SMTP, "smtphm.sympatico.ca" );
ini_set( smtp_port, 25 );
If your smtp server requires authentication to relay - the PHP mail() is not very flexible. You might be able to take advantage of the php pear add-on. Here is a really easy tutorial:
http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm
I hope you get it working.
For example:
ini_set ( sendmail_from, "my_email@my_server.com" );
ini_set( SMTP, "smtphm.sympatico.ca" );
ini_set( smtp_port, 25 );
If your smtp server requires authentication to relay - the PHP mail() is not very flexible. You might be able to take advantage of the php pear add-on. Here is a really easy tutorial:
http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm
I hope you get it working.
Phpmailer is your friend
ASKER
Apparently, the Cc semicolons.
ASKER
To all,
The server is php email configured; I am sending other emails from this site in several other places.
It seems that the semicolon in header causes failure (as per requeue). I am successfully using ; in the mail "to" string, I guess it's in the header that it causes the issue.
Thanks all!
The server is php email configured; I am sending other emails from this site in several other places.
It seems that the semicolon in header causes failure (as per requeue). I am successfully using ; in the mail "to" string, I guess it's in the header that it causes the issue.
Thanks all!
Open in new window
instead ofOpen in new window
so you don't need to assume.Even better:
Open in new window