문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top