Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problems with html in mail()

Status
Not open for further replies.

safra

Technical User
Jan 24, 2001
319
0
0
NL
hi,

I found this example to send an email in html format:

Code:
$email = 'sendfrom@email.com'; 
$toMail = 'your@email.com';
$subject="email subject";
$message = "email contents";
$var = mail("$toMail", "$subject", "$message","Content-type: text/html\n",
     "From: $email\n"
    ."Reply-To: $email\n"
    ."sendmail_path: /usr/sbin/sendmail\n");

the problem is that the 'from' and 'reply-to' email addresses are not parsed correctly. It states 'nobody'.

Without 'Content-type: text/html\n' those emails are parsed correctly.

Anyone knows how to fix this?

Thanks,
Ron
 
Try this:

$var = mail($toMail, $subject, $message,
"Content-type: text/html\n\r
From: $email\n\r
Reply-To: $email",
"sendmail_path: /usr/sbin/sendmail\n");

The comma between the content header and the from header was probably throwing it off. Also there should have been a comma between the reply-to header and the sendmail_path additional parameter.
 
my code was a little off ... give this one a try

$var = mail("$toMail", "$subject", "$message",
"Content-type: text/html\nFrom: $email\nReply-To: $email\n",
"sendmail_path: /usr/sbin/sendmail\n");
 
Hi Hokey,

Thanks for helping me with this.

I tried your suggestions. What happens is that the From and Reply-To part is now added to the contents of the email.

The sender information in the inbox overview still states "nobody" and the properties shows nobody@myserver.com.

Any ideas?

Thanks,
Ron


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top