html mail()

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!

Moderator: General Moderators

Post Reply
Jim_Bo
Forum Contributor
Posts: 390
Joined: Sat Oct 02, 2004 3:04 pm

html mail()

Post by Jim_Bo »

Hi,

Im using the following for html mail().

It works except when you read the mail in "from" is says:

account_username@webhoster.com

Rather than the persons email who submited the form, also its the same when reply is hit.

Code: Select all

$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "$name <$email>";
$to = 'Bla<bla@bla.com>';
$subject = "Re: Online Registration";
$message = '<font size="2" face="tahoma">Hi Admin<br><br>
Record Id: '.$id.'</font>';

mail($to, $subject, $message, $headers);
How should it be so it has "$name $mail" in the "from" box and also uses "$name <$mail>" in the reply address?

Rather than having my username@mywebhoster.com?


Thanks
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post by Skara »

Code: Select all

$headers .= "$name <$email>";
that doesn't make any sense...

Code: Select all

$headers .= "From: $name <$email>\r\n";
$headers .= "Reply-To: $name <$email>\r\n";
Jim_Bo
Forum Contributor
Posts: 390
Joined: Sat Oct 02, 2004 3:04 pm

Post by Jim_Bo »

Hi,

That works ..

thanks
Post Reply