Jump to content

PHP Mail


jimleeder123

Recommended Posts

I have tried using the code on that website but it comes up very weirdly.

 

Using this code:

 

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: James <blah@blah.co.uk>'. "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
               
        
        mail($to,$subject,$message,$headers);

 

Brings up the result below (Only e-mail body pasted, can't post screenshot). Why is this? The HTML isn't working and Outlook isn't displaying the headers as I thought.

 

Content-type: text/html; charset=iso-8859-1

 

To: James <james@blah.co.uk>

 

From: Birthday Reminder <birthday@example.com>

 

Cc: birthdayarchive@example.com

 

Message-Id: <20150605085118.303EA12206CA@localhost.prophettech.co.uk>

Date: Fri,  5 Jun 2015 09:51:18 +0100 (BST)

 

 

 

3.99 // variable is sent to email correctly like this

 

Margherita

 

  <i>Test</i>

Link to comment
Share on other sites

it's been a long time since I created any custom mail, but I did post up my old script for creating a multi-part MIME mail using the PEAR Net_SMTP.  Looking through that I remember that there are some nuances to getting each part of the message to work, including adding a content-type into the message as well as the header.  you'll find my code :here: looking over how the message was constructed could give you some insight into getting the html to work.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.