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? Quote Link to comment 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... Quote Link to comment 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 <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> Quote Link to comment 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. Quote Link to comment 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. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.