jimleeder123 Posted June 4, 2015 Share Posted June 4, 2015 I've got this: mail($to,$subject,$message,"Content-type: text/html; charset=iso-8859-1"); It sends through HTML e-mail fine, but I can't get it to show both who its from, and get the HTML bits in ("Content-type: text/html; charset=iso-8859-1"). Can anyone help please? Link to comment https://forums.phpfreaks.com/topic/296644-php-mail/ Share on other sites More sharing options...
Muddy_Funster Posted June 4, 2015 Share Posted June 4, 2015 Well, the second example on the manual page (here) covers multiple additional headers... Link to comment https://forums.phpfreaks.com/topic/296644-php-mail/#findComment-1513175 Share on other sites More sharing options...
jimleeder123 Posted June 5, 2015 Author Share Posted June 5, 2015 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 More sharing options...
Muddy_Funster Posted June 5, 2015 Share Posted June 5, 2015 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 More sharing options...
fastsol Posted June 5, 2015 Share Posted June 5, 2015 Using a php library like phpmailer would make this a null subject cause it will automatically build all that for you, plus helps in delivery since it builds all the needed parts automatically. Link to comment https://forums.phpfreaks.com/topic/296644-php-mail/#findComment-1513258 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.