Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8969669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:37:31+00:00 2026-06-15T17:37:31+00:00

I am using PHP mailer to send an online form directly to email. I

  • 0

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();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:37:31+00:00Added an answer on June 15, 2026 at 5:37 pm

    By default, the PHP mail() function is text/plain.

    In your mail() headers, change the content-type to text/html and try.

    Example:

    <?php 
        $body = "<html>\n"; 
        $body .= "<body style=\"font-family:Verdana, Verdana, Geneva, sans-serif; font-size:12px; color:#666666;\">\n"; 
        $body = $message; 
        $body .= "</body>\n"; 
        $body .= "</html>\n"; 
    
        $headers  = "From: My site<noreply@example.com>\r\n"; 
        $headers .= "Reply-To: info@example.com\r\n"; 
        $headers .= "Return-Path: info@example.com\r\n"; 
        $headers .= "X-Mailer: Drupal\n"; 
        $headers .= 'MIME-Version: 1.0' . "\n"; 
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
    
        return mail($recipient, $subject, $message, $headers); 
    ?>
    

    PHP Mailer:

    You need to set IsHTML(true):

    $mail->IsHTML(true);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to send email using the php code, Following is the code should
I am using swift mailer using this statement: require_once 'lib/swift_required.php'; to send email. It
I have send an email using php mailer class. mail was sending successfully but
Having big problems trying to get my php script to send email. Using this
I'm trying to accomplish the following, I'm sending a HTML email using PHP Mailer
I am trying to send email using mail() in php. I need the message
I am using php mailer class to send email to my customers. But it
As advised I have tried using PHP Mailer to send email attachments with a
I am using PHP Swift Mailer to send Mail to my user, whose email
Using PHP I echo out table rows in a loop like this: <?php /*

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.