Matthew2000 Posted September 9, 2018 Share Posted September 9, 2018 Folks, I have sent many emails over the years with PHP and never had an HTML problem. I launched a new Apache/PHP server the other day and emails send fine. All emails send as plain text. Seems like the encoding isn't working. Even with the: $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; Being set... the email sending is not HTML, but plain text. I can take this same PHP script and run it on another server and I get an HTML email. So I know my PHP script is correct. What server setting in PHP/Apache would cause all emails to be sent as plain text ? Here is what the recipient receives on their end in the message area of the text email: Content-type: text/html; charset=iso-8859-1 From: no-reply@yahoo.com Message-Id: <20180909154528.C4128612EC@ww1.localdomain> Date: Sun, 9 Sep 2018 11:45:28 -0400 (EDT) <html><body><h1>Hello, World!</h1></body></html> My script code: $to = 'test99@domain.com'; $subject = 'php test'; $from='no-reply@yahoo.com'; $headers =''; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: '.$from.' '. "\r\n"; $message = '<html><body>'; $message .= '<h1>Hello, World!</h1>'; $message .= '</body></html>'; mail($to, $subject, $message, $headers); Quote Link to comment Share on other sites More sharing options...
requinix Posted September 10, 2018 Share Posted September 10, 2018 If they're seeing stuff like the Message-Id in the message area then it's the sendmail client on your server that's messed up. Ask your hosting provider to look into it. You should send them an example of the full message as received by the client's (I suggest yours for this) mail server, for example what Gmail's "Show original" does. 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.