I am using PHP mailer to send an online form directly to email. I want to edit the form like this:
$message = '<p>The following request was sent from: '</p>;
$message .= '<p>Name: '.$name.'</p><br />';
$message .= '<p>Phone: '.$phone.'</p><br />';
$message .= '<p>Email: '.$email.'</p><br />';
However, in the email I receive back, I get the <p>, <br />, etc.  Not the formatting I want, but the actual HTML.  It has always worked for me, then I realized I was using the stock PHP mail function.  not sure if PHP mailer has different parameters OR if I just missing small here?
Where would I set the headers for text/html?
    $mail = new PHPMailer();
    $mail -> IsSMTP();
    $mail -> Host = "---";
    $mail -> Port = 25;
    $mail -> SMTPAuth = false;
    $mail -> Username = EMAIL_USER;
    $mail -> Password = EMAIL_PASS;
    $mail -> FromName = $from_name;
    $mail -> From = $from;
    $mail -> Subject = $subject;
    $mail -> Body = $message;
    $mail -> AddAddress("---");
    $result = $mail -> Send();
                In PHP mailer, you need to set below
$mail->IsHTML(true);
Note: $mail means your PHPMailer object.
Reference Link: PHPMailer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With