markguinn / silverstripe-email-helpers

Silverstripe extension containing SMTP mailer class and some other classes for HTML emails
31 stars 22 forks source link

Inline CSS by default #9

Closed AntonyThorpe closed 8 years ago

AntonyThorpe commented 8 years ago

It would be a great benefit to inline CSS in HTML emails by default. This combined with the reliable PHPMailer and your easy configuration will create better looking emails for Silverstripe sites.

Was inspired by https://github.com/sunnysideup/silverstripe-newsletter_emogrify/blob/master/code/EmogrifierMailer.php and https://github.com/burnbright/silverstripe-inlinestylesemail/blob/master/code/InlineStylesMailer.php both of which inline CSS but without PHPMailer.

Have tested this pull request on a soon to be launched SS Shop site.

Thanks

markguinn commented 8 years ago

Thanks, Anthony, I like this a lot. I think there should be an option to use the module without emogrifier though. Either a config setting on on SmtpMailer or a second mailer (i.e. SmtpMailer stays the same and we move this code to EmogrifiedSmtpMailer). I'd lean toward the former because it's easier to add to your existing code. What are your thoughts?

AntonyThorpe commented 8 years ago

Thanks for your advice Mark. Have gone for the separate class option and added PHPMailer SMTP debug and error log options to the new EmogrifiedSmtpMailer class. Any feedback please?

markguinn commented 8 years ago

Works for me. Thanks!