-1

i have email template which consist of html tags like this

$mail->Body = '<td style="color: #848484; font-size: 14px; font-family: Calibri, 
sans-serif, 'Open Sans'; line-height: 18px; border-collapse: collapse;" 
align="left">Copyright (C) 2016 example All rights reserved.</td>';

Now if i change 'Open Sans' into "Open Sans" fonts become messy in look & there are more tags in template which consist of Apostrophe

what could be the best way of sending this email template without getting any error

Aniket Singh
  • 857
  • 4
  • 16
  • 39

2 Answers2

1

If you delimit a string literal with single-quotes, and want to use single-quotes inside the string content, you need to escape them with a backslash:

$mail->Body = '<td style="color: #848484; font-size: 14px; font-family: Calibri, 
sans-serif, \'Open Sans\'; line-height: 18px; border-collapse: collapse;" 
align="left">Copyright (C) 2016 example All rights reserved.</td>';

Same thing with double-quotes instead:

$mail->Body = "<td style=\"color: #848484; font-size: 14px; font-family: Calibri, 
sans-serif, 'Open Sans'; line-height: 18px; border-collapse: collapse;\" 
align=\"left\">Copyright (C) 2016 example All rights reserved.</td>";
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
0

You should Use htmlspecialchars HTML Special Chars

Naresh Kumar
  • 561
  • 2
  • 15