|
Posted by ZeldorBlat on 06/13/07 13:01
On Jun 13, 7:06 am, Spartacus <nos...@nowhere.com> wrote:
> Hello,
>
> I know there is lots of information out there and I've taken a look, but
> I want to learn how to do this myself. And I'm a beginner here and some
> of it I don't understand (so no flames, RTFM or GFGI please ;)
>
> Here's my function:
>
> function send_mail($to_name, $to_email, $from_name, $from_email,
> $subject, $message)
> {
> $thedate = date("r", time());
>
> $headers = "X-Mailer: PHPMailProgram/1.0\n";
> $headers .= "From: \"".$from_name."\" <".$from_email.">\n";
> $headers .= "Date: $thedate\n";
> $headers .= "Content-Type: text/plain\n\n";
>
> $from = "\".$from_name."\" <".$from_email.">";
>
> return mail( $from, $subject, $message, $headers);
>
> }
>
> My problem is that it will never arrive with the "Name" <email address>,
> and I can only make it work using email addresses without the names or
> the angle brackets around the email addresses. Once I tried printing the
> headers and the quotes and angle brackets turned up, but no names or
> email addresses. And once an email arrived but with nothing but angle
> brackets! (I wonder how that happened? The SMTP server must have
> stripped things out perhaps?)
>
> Thanks for your time in helping me with this,
>
> Spartacus
First, headers need to be separated by "\r\n", not just "\n". Try
that and see if it works any better.
Navigation:
[Reply to this message]
|