Search code examples
phphtmlemailembedemail-formats

How to Embed HTML code inside email using PHP


I want to include an html meta tag inside an email which we are sending using PHP.

<meta name=\"yyyy\" content=\"uuuuu\" />

I'm expecting the email like:

Hello,

Thank you for subscribing. Please include the below code in <head>

<meta name=\"yyyy\" content=\"uuuuu\" />

Thanks & Regards,

yy

What is the best way to include html code inside email which will work for all email servers like Gmail, Outlook etc.

Thanks in advance.


Solution

  • This is the function you need :

    $codeValue = htmlspecialchars("<meta name=\"yyyy\" content=\"uuuuu\" />");
    

    This way the code won't be interprated