Sending a email message having HTML tags via PHPMailer using PHP heredoc feature
<p>When a user fills out a contact form, I want the user to get an HTML message with a image at the start of message and some styling for a box with shadow in which the user's name and phone
number are shown.</p>

<p>I tried using $mail->IsHTML(true) and $mail->msgHTML($message) using PHPmailer but the message was not sent.</p>

<p>The message is below:</p>

<pre><code>$message = &lt;&lt;&lt;STARTMESSAGE

     &lt;script src='http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js'&gt;&lt;/script&gt;
     &lt;link href='http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css' rel='stylesheet'&gt;    

     &lt;style type='text/css'&gt;

        .box {
                margin: 40px;


                -moz-box-shadow: 5px 5px 5px rgba(68,68,68,0.6);
                -webkit-box-shadow: 5px 5px 5px rgba(68,68,68,0.6);
                box-shadow: 5px 5px 5px rgba(68,68,68,0.6);


                display: block;
        }

        .content {
            position:relative;
            padding:100px;
            background-color:FFF;
        }

        .h3 {
            text-align:center;
            color:#008800;
        }
     &lt;/style&gt;



        &lt;img src='./img/logo.png' class='img-responsive center-block' alt='My website'&gt;

    &lt;h3&gt; Contact Form Submission &lt;/h3&gt;

     &lt;div class='box'&gt;
        &lt;div class='content'&gt;

    The following information was submitted: &lt;br/&gt; &lt;br/&gt;



    &lt;strong&gt;Full Name:&lt;/strong&gt; $firstname $lastname &lt;br/&gt; &lt;br/&gt;
    &lt;strong&gt;Phone number:&lt;/strong&gt; $phone  &lt;br/&gt; &lt;br/&gt;
     &lt;/div&gt;
       &lt;/div&gt;
STARTMESSAGE;
</code></pre>

<p>Edit:</p>

<pre><code>$mail = new PHPMailer;
//Set who the message is to be sent from
$mail-&gt;setFrom($from , "Contact Form");
$mail-&gt;addAddress('myemail@example.org', "John Doe");

$mail-&gt;Subject = "Contact Form submission ".$name;


$mail-&gt;IsHTML(true);
$mail-&gt;Body = $message;

//$mail-&gt;msgHTML($message);

$mailsent = $mail-&gt;send();

if (!$mailsent)
    {
            echo "Mailer Error: " . $mail-&gt;ErrorInfo;
            error_log("Mail not sent for $firstname $lastname $mail-&gt;ErrorInfo \n", 1, "myemail@example.org");
            error_log("Message text is  $message \n", 1, "myemail@example.org");
            error_log("Value of variables from POST method $post_variables \n ", 1, "myemail@example.org");
            error_log("\n Value of variables from POST method $post_variables \n", 3, "logfile.txt");
            $logfile = fopen("errorlog.log","w+") or die("cannot open log file");
            fwrite($logfile,"Mail not sent for $firstname $lastname");
            $backtrace = debug_print_backtrace();
            fwrite($logfile,"Back trace is \n");
            fwrite($logfile,$backtrace);

    }
    else
    {
            echo "Message sent!";
            error_log("\n Mail sent for $firstname $lastname at $date \n", 3, "logfile.txt");
            error_log("\n Value of variables from POST method $post_variables \n", 3, "logfile.txt");                               
            header('Location: http://www.example.org/index.php?success=yes');               
    }
</code></pre>