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 6193189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:04:36+00:00 2026-05-24T03:04:36+00:00

I am trying to send an HTML mail through PHP, but I can’t seem

  • 0

I am trying to send an HTML mail through PHP, but I can’t seem to get it working.

This is my code:

    // multiple recipients
    $to  = 'mail';

    // subject
    $subject = 'Subject';

    // message
    $message = "
    <html>
    <head>
      <title>Thanks</title>
    </head>
    <body>
        <div>
            <b>Thanks for your email</b>
        </div>
    </body>
    </html>
    ";

    // To send HTML mail, the Content-type header must be set
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

    // Additional headers
    $headers .= 'To: info <info@example.com>' . "\r\n";
    $headers .= 'From: Pynix <info@example.com>' . "\r\n";

    // Mail it
    mail($to, $subject, $message, $headers);

This also doesn’t show any sender when I receive it in Outlook.

Anyone an idea?

Thanks

  • 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-05-24T03:04:36+00:00Added an answer on May 24, 2026 at 3:04 am

    I don’t think you have to put the To: line in the header as it is a parameter of the mail function.
    However some mail clients don’t like light headers, here’s mine which is working:

    $header = 'From: "Contact" <mail>'.PHP_EOL.
                      'Reply-to: <mail>'.PHP_EOL.
                      'MIME-Version: 1.0'.PHP_EOL.
                      'Content-Type: text/plain; charset=utf-8'.PHP_EOL.
                      'Content-Transfer-Encoding: 8bit'.PHP_EOL.
                      'X-Mailer: PHP/'.PHP_VERSION.PHP_EOL;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to send out html emails through a PHP mail script
Can somebody please help me with this mail script. I'm simply trying to send
I'm trying to do a very simple mail form in PHP but get the
I am trying to send an email with PHP but I get a weird
I am trying to send an HTML email using Perl. open(MAIL,|/usr/sbin/sendmail -t); ## Mail
I am trying to send mail through grails mail plugin. I configured according to
I'm trying to e-mail a html table, that has links within it. But when
I am trying to send notification emails(which is working fine) but have added the
I am trying to create a PHP function to send an e-mail using SMTP
Strange things happening to me. I'm trying to send a HTML mail, using the

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.