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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:32:32+00:00 2026-06-02T01:32:32+00:00

I have this code to send an email via PHP: // Prepare email. $headers

  • 0

I have this code to send an email via PHP:

// Prepare email.
$headers = "From: Mi9 Vault <info@mi9vault.com.au>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=ISO-8859-1";

$msg = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/edm/confirmation.html');
$msg = str_replace('{first_name}', $contact["First Name"], $msg);


// Send email
mail($contact["Email Address"], "Your Mi9 Registration is Confirmed", $msg, $headers);

confirmation.html is a HTML email that we’ve set up.

I’ve never had any trouble with the above PHP code for sending emails before, however all I can seem to get back is an email containing all of the HTML rather than an actual HTML formatted email.

Basically I get an email with this as the content:

MIME-Version: 1.0

Content-type: text/html; charset=ISO-8859-1
Message-Id: <20120418080325.C643B407EF@ds3219.dreamservers.com>
Date: Wed, 18 Apr 2012 01:03:25 -0700 (PDT)

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    </head>
    <body>
        .....

I have the same PHP code on another website with the same host and it works fine…

  • 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-02T01:32:34+00:00Added an answer on June 2, 2026 at 1:32 am

    It seems from that somehow there are extra line breaks between each two lines of your headers. How it manages to happen, I’m not sure, as your code doesn’t put them there. It’s possible that the receiving mail server is messed up somehow and interprets \r\n as two line breaks instead of one. To start with, I would remove \r leaving only \n in and see what happens. I know this is not proper per RFC – but start with that.

    To make you feel better, I am using a very similar code – and the email gets delivered correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code written in .NET 4.0 using VS2010 Ultimate Beta 2: smtpClient.Send(mailMsg);
I have this code, the idea is to read from a file and the
i have this code preg_match_all('%(?:youtube\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^&?/ ]{11})%i', $asd, $match); to find youtube key of urls
i have this code: <!DOCTYPE HTML> <html> <head> <script src=http://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojo/dojo.js type=text/javascript djConfig=parseOnLoad: true></script> <script
I am writing a PHP script that will send via a cron an email
I have a code like this <script type=text/javascript> function email(){ var myTextField = document.getElementById('email_hidden').value;
I have currently written code to send an email in C# using the usual
I am pretty new with the options of sending email via PHP code. The
I'm sending a source code package to someone via email. I have sent them
This seems to be pretty straight forward. I need to send email from some

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.