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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:24:47+00:00 2026-05-23T12:24:47+00:00

Strange things happening to me. I’m trying to send a HTML mail, using the

  • 0

Strange things happening to me. I’m trying to send a HTML mail, using the php mail() function, but no luck here. Even when I copy/paste a piece of code literally, it doesn’t work. What am I doing wrong? Here is the piece of code I use:

        $message = "<html><body>";
        $message .= "<table rules='all' style='border-color: #666;' cellpadding='10'>";
        $message .= "<tr style='background: #eee;'><td><strong>Name:</strong> </td></tr>";
        $message .= "<tr><td><strong>Email:</strong> </td></tr>";
        $message .= "</table>";
        $message .= "</body></html>";       

        $to = 'me@gmail.com';

        $subject = 'Website Change Reqest';

        $headers = "From: " . $email . "\r\n";
        $headers .= "Reply-To: ". $email . "\r\n";
        $headers .= "MIME-Version: 1.0\r\n";
        $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

        if (mail($to, $subject, $message, $headers)) {
          echo 'Your message has been sent.';
        } else {
          echo 'There was a problem sending the email.';
        }

And this is what my e-mail looks like…:

Reply-To: me@gmail.com

MIME-Version: 1.0

Content-Type: text/html; charset=ISO-8859-1
Message-Id: <20110703234551.A9D6153DAB@apache10.hostbasket.com>
Date: Mon, 4 Jul 2011 01:45:51 +0200 (CEST)

<html><body><table rules="all" style="border-color: #666;" cellpadding="10"><tr style='background: #eee;'><td><strong>Name:</strong> </td></tr><tr><td><strong>Email:</strong> </td></tr><tr><td><strong>Type of Change:</strong> </td></tr><tr><td><strong>Urgency:</strong> </td></tr><tr><td><strong>URL To Change (main):</strong> </td></tr><tr><td><strong>NEW Content:</strong> </td></tr></table></body></html>

What do I do wrong?

  • 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-23T12:24:47+00:00Added an answer on May 23, 2026 at 12:24 pm

    We can’t see where the variable $email was set, but I’m guessing that there might be an extra line break at the end of your $email variable. This would have the effect of putting in two linebreaks after the From: header and before the Reply-to: , which signals the start of the body of the message and the completion of the headers.

    Try:

    $email = trim($email);
    

    before constructing the message. Since there appears to be an extra line break after the Reply-to header as well, my case is even stronger for an extra break in $email.

    UPDATE

    Also try changing the linebreaks to PHP’s native format on the system where the code will run. This is done by replacing \r\n with PHP_EOL

        $headers = "From: " . $email . PHP_EOL;
        $headers .= "Reply-To: ". $email . PHP_EOL;
        $headers .= "MIME-Version: 1.0" . PHP_EOL;
        $headers .= "Content-Type: text/html; charset=ISO-8859-1" . PHP_EOL;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I presently have CKeditor setup on a webpage, but strange things are happening when
Hi guys I have a very frustrating and strange thing happening here, when I
Very strange things happening in phpMyAdmin (mySQL).... The Situation: I have a table with
Seeing some strange things; help is being solicited. I have a query, like so:
I am developing an OpenGL application and I am seeing some strange things happen.
I'm doing some coding in JSP/Java (without any framework, or other strange things) and
Some things look strange to me: What is the distinction between 0.0.0.0, 127.0.0.1, and
I've got a strange problem. I've been using just javascript forever now, and I'm
This seems very strange to me but I have a script that I'm running
I have noticed a strange piece of behaviour when using MessageDlg and attempting to

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.