1

I am trying to send newsletter but when I entered text like:

2nd year, 3rd Special Edition “A Tribute” of 7sisters.in has been released.
Dear Sir / Madam,

Welcome to "7sisters.in".

The output is:

2nd year, 3rd Special Edition “A Tribute†of 7sisters.in has been released.
Dear Sir / Madam,

Welcome to "7sisters.in".`

I followed the answer here:

Correctly encode characters in a PHP mail form ("I'm" turns to be "I\'m")

My PHP code is:

$to = $allEmails[$i];
$subject = $sub;
$message = $msg;
//$message .= '<p>To unsubscribe , click here <a href="http://www.7sisters.in/index.php?menu=unsubscribe&email='.$to.'">Unsubscribe</a></p>';
$message .= '<br />To unsubscribe , click here ';
$message .= "http://www.7sisters.in/index.php?menu=unsubscribe&email=".$to;
$message = stripcslashes($message);


$from = $from_mail;
//$headers = "From:" . $from;

$headers = "From:" . $from . "\r\n" .
               "Reply-To:" . $from . "\r\n" .
               "X-Mailer: PHP/" . phpversion();
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";        

mail($to,$subject,$message,$headers);

How do I deal with double quotes properly when using mail()?

Community
  • 1
  • 1
Nitish
  • 2,695
  • 9
  • 53
  • 88

1 Answers1

4

You have an encoding problem: Your string is in UTF-8, but your content-type header states the charset as iso-8859-1.

If you want to send the mail in iso-8859-1, use utf8_decode to convert it.

Anders Lindahl
  • 41,582
  • 9
  • 89
  • 93
  • Now it is coming like `2nd year, 3rd Special Edition ?€?A Tribute?€? of 7sisters.in has been released. Dear Sir / Madam, Welcome to "7sisters.in".`. I have changed `$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";` to `$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";` – Nitish Dec 10 '11 at 07:12
  • Wih utf8_decode? And how did you change the charset (your comment does not contain any difference between the two lines). – Anders Lindahl Dec 10 '11 at 07:21
  • So sorry...it should be `$headers .= 'Content-type: text/html; UTF-8' . "\r\n"; ` – Nitish Dec 10 '11 at 07:23
  • Ok its coming..Thanks . I missed `charset=` – Nitish Dec 10 '11 at 07:46