utf-8 and email

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
eyespark
Forum Commoner
Posts: 50
Joined: Tue Jan 24, 2006 7:36 am

utf-8 and email

Post by eyespark »

Hi

I'm sending email with this code:

Code: Select all

<? $recipient = "$friend_mail";
$send_subject = "ma subject";
$message = "my message.\n";
		
$headers  = 'X-Mailer: PHP/' . phpversion() . "\r\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Return-Path: $sender_mail\r\n";
$headers .= "Reply-To: $sender_mail\r\n"; 
$headers .= "From: $sender_name <$sender_mail>\r\n"; 
$headers .= "Content-Type: text/plain; charset=utf-8\r\n\r\n";
$headers .= "Content-Transfer-Encoding: base64\r\n\r\n"; 

mail ($recipient, $send_subject, $message, $headers);
?>
My problem is that the first line in recieved mail body is: Content-Transfer-Encoding: base64.

Why? Is this normal?

Thanks
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

because you have a double linebreak after that header, which delimiters the end of the header section of the email
eyespark
Forum Commoner
Posts: 50
Joined: Tue Jan 24, 2006 7:36 am

Post by eyespark »

Hi

I just tried your solution (erased one linedreak) but it is stil the same.

Thanks
eyespark
Forum Commoner
Posts: 50
Joined: Tue Jan 24, 2006 7:36 am

Post by eyespark »

Aaaaaah, yes! Changed Content-Transfer-Encoding to 8bit and it works.

Now I have to figure out why email goes to junk mailbox. Any ideas?

Thanks
Post Reply