2

I am setting up email messaging for my site. When I send emails for trial reminders displaying subscription prices, the recieved email displayes them incorrectly. This is the code template for the email:

$message = '<html><head><meta charset="UTF-8"></head>';
$message .= '<body style="text-align: center">';
$message .= '<div style="padding: 30px; margin: 0 auto; display: block; background: lightslategray; height: 500px; ">';
$message .= '<div style="width: 80%; margin: 0 auto; display: block; background: white; height: 440px; padding: 30px ">';
$message .= '<div style="background-color: #343a40" >';
$message .= '<div style="padding: 10px ">';
$message .= '<div href="" style="font-size: 23px;text-align: center; color: orange; margin: 0 5px;padding-bottom: 10px;border-bottom: 1px solid lightgrey; ">';
$message .= '<a   style="color: orange;text-decoration: none;"></a>';
$message .= '</div>';
$message .= '</div>';
$message .= '</div>';

$message .= '<h2>Your Trial Ends In 1 Week </h2><br>';
$message .= '<p>Subcriptions are £10 Per Year $  €</p>';

$message .= '<br>';
$message .= '<br>';
$message .= '<br>';
$message .= '<br>';
$message .= '<p>For help or if you have any questions, <a href="">contact us or visit the FAQ section</a></p>';
$message .= '<a title="Follow us on Facebook" target="_blank" href=">Follow Us On Facebook</a>';


$message .= '</div>';
$message .= '</div>';
$message .= "</body></html>";

The part in questions is the Subscription prices. The dollar symbol displays correct in the email however pounds and euro display as in the picture.

Wondering if anyone can help me solf this. Thanks

enter image description here

pilotman
  • 624
  • 1
  • 6
  • 23
  • It's an encoding issue. Most email clients ignore the `` tag to set the character set. You need to make sure the message's content-type mime-header also sets it. See [this question](https://stackoverflow.com/q/1666098/1941241) for some examples. – rickdenhaan May 08 '21 at 21:26

2 Answers2

4

You don't need to use HTML entities – and they won't work in plain-text emails anyway. The easiest way to make this work is:

$mail->CharSet = 'utf-8';

Then you can use the text as-is without any encoding.

Synchro
  • 35,538
  • 15
  • 81
  • 104
1

Use html character entities.

For £ use &pound; or &#x000A3; or &#163;

For use &euro; or &#x020AC; or &#8364;

B001ᛦ
  • 2,036
  • 6
  • 23
  • 31