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 <[email protected]>'. "\r\n";
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\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 <[email protected]>

 

From: Birthday Reminder <[email protected]>

 

Cc: [email protected]

 

Message-Id: <[email protected]>

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
https://forums.phpfreaks.com/topic/296644-php-mail/#findComment-1513233
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
https://forums.phpfreaks.com/topic/296644-php-mail/#findComment-1513246
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.