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!
<?php
// The message
session_start();
$message = "Line 1\nLine 2\nLine 3";
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);
echo "UM....";
// Send
if (mail('Webmaster <webmaster@mysite.com>', 'My Subject', $message)) {
echo 'E-mail sent.';
}
else {
echo "uh oh!";
}
?>
And I get:
UM....Recipient names must be specified E-mail sent.
I put the echo 'UM...' there just because if I don't echo something while I'm testing it and having this problem, it gives me an internal 500 error.
I took this code straight from the PHP site other than the echos, the "if", and the session_start(); I'm at a loss here.
This is probably unrelated to the problem at hand, but according to RFC 2822:
Messages are divided into lines of characters. A line is a series of
characters that is delimited with the two characters carriage-return
and line-feed; that is, the carriage return (CR) character (ASCII
value 13) followed immediately by the line feed (LF) character (ASCII
value 10).
This applies to the lines in your custom header ($mailheader). Your header lines should end with:
Address is hand-coded
As far as the mail header goes, thanks for the tip - I'll remember that, but the error mentions the recipient names. I don't know why it says name"s".