Question

I have a block of Heredoc for email that I am sending out. In this block I am trying print selected text in bold/strong.

Take the following block of heredoc as an example.

<<<ENDINGTEXT

    Example text

    more text

    <b>This in bold</b>

ENDINGTEXT;

When I send above out as an email. The "b" tags do not convert the text within it to be bold. In the email it gets displayed as it is with b tags intact.

can someone please show me the way to achieve this as well some basic HTML integration in heredoc.

Was it helpful?

Solution

That is because the email which you are sending does not contain HTML enabled headers.

You need to set the headers like this.

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

For a detailed example, see the PHP Manual here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top