L
L
Lev Rozanov2014-09-11 16:30:32
PHP
Lev Rozanov, 2014-09-11 16:30:32

How to implement message body encoding when sending with mail() function?

Good day!
Help with the encoding of the body of the message, EXACTLY the body of the message.
I searched, but apart from the from and subject encoding, there is nothing.
Required :
$to = '[email protected]';
$subject= 'subject';
$msg = "Message text"; // set the encoding for the content of this variable!!!
mail($to, $subject, $msg, 'From: '.$email);
Thanks in advance and sorry if this is a simple question.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
akarin, 2014-09-11
@MetisKot

/* Для отправки HTML-почты вы можете установить шапку Content-type. */
$headers= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

/* дополнительные шапки */
$headers .= "From: Birthday Reminder <[email protected]>\r\n";
$headers .= "Cc: [email protected]\r\n";
$headers .= "Bcc: [email protected]\r\n";

/* и теперь отправим из */
mail($to, $subject, $message, $headers);

www.php.su/functions/?mail

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question