floridaflatlander Posted December 6, 2013 Share Posted December 6, 2013 How can I set up pretty/styled emails and mailing list? I can use php's mail() and I use it all the time but I can't style the email article or add pics. Every time I add an h1 tag for a test I get <h1> in the email not the style text. Does anyone have links to tell me how to do this?Is it worth the hassle?Would it just be easier just to use someone like constantcontact dot com Thanks Quote Link to comment https://forums.phpfreaks.com/topic/284586-how-can-i-set-up-prettystyled-emails/ Share on other sites More sharing options...
kicken Posted December 6, 2013 Share Posted December 6, 2013 In order for the message to be parsed as HTML, you need to set it's Content-type header to text/html. You can do this using the fourth parameter of the mail function. As a rule of thumb, you should also send a plain-text copy of your emails if you send a HTML message. That way people who cannot or choose not to receive HTML based email still see a readable message rather than a bunch of HTML garbage. In order to do this though you need to generate a proper MIME message with the correct headers and body structure. If you ever want to add attachments you'll need MIME as well. It's better to just use a mailing library rather than try and handle all this stuff (and more) yourself. A couple popular libraries for PHP are Swiftmailer and PHPMailer. Check those out, see which one you prefer and use it. Or as you mentioned, just use a third-party to do your mailing, which may open up more features such as tracking. Quote Link to comment https://forums.phpfreaks.com/topic/284586-how-can-i-set-up-prettystyled-emails/#findComment-1461507 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.