jimleeder123 Posted June 9, 2015 Share Posted June 9, 2015 I'm still having trouble with the headers for PHP Mail. I can make the email work with just the HTML header and no "From" header. However if I have the "From" Header, the "from" address works, but then the HTML doesn't. Below is my code, does anyone know how to fix this please? $headers = 'From: JMS <thejms@jms.co.uk>' . "\r\n";$headers.= "Content-type: text/html; charset=iso-8859-1" . "\r\n"; mail($to,$subject,$message,$headers); Quote Link to comment Share on other sites More sharing options...
ginerjm Posted June 9, 2015 Share Posted June 9, 2015 Usually the from address must be from the same domain that this email is being sent from. Is your domain jms.co.uk? Quote Link to comment Share on other sites More sharing options...
jimleeder123 Posted June 9, 2015 Author Share Posted June 9, 2015 No, I've tried an address with my own domain and that doesn't work. I've got this, but the from address doesn't work, and HTML does work: $headers= 'Content-type: text/html; charset=iso-8859-1';$headers.= 'From: James <blah@blah.co.uk>' . "\r\n"; Quote Link to comment Share on other sites More sharing options...
ginerjm Posted June 9, 2015 Share Posted June 9, 2015 (edited) Can we see all the relevant code? Maybe an echo of the arguments in the mail() call? Edited June 9, 2015 by ginerjm Quote Link to comment Share on other sites More sharing options...
jimleeder123 Posted June 9, 2015 Author Share Posted June 9, 2015 Everything is working except the headers. The mail call is: mail($to,$subject,$message,$headers); Quote Link to comment Share on other sites More sharing options...
boompa Posted June 9, 2015 Share Posted June 9, 2015 You will make your mailing life easier if you take the time to learn how to use a third-party mailing library like PHPmailer or Swiftmailer and take advantage of them. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted June 9, 2015 Share Posted June 9, 2015 You won't show us the contents of the arguments? Why? 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.