2

I have developed websites using Drupal since 1998. Getting Simplenews to send HTML formatted emails in D8 has been the most frustrating experience I've had in all those years. I am very upset. I find the current state of D8 documentation to be quite shoddy overall, not just Simplenews. Here's a glaring example of what I'm talking about: I'm building a D8 site using D8 modules. I go to the README file in the simplenews directory and I'm reading all about how.

You can customize the theming of newsletters. Copy any of the *.tpl.php files from the simplenews module directory to your theme directory. Both general and by-newsletter theming can be performed. Theme newsletter body:

  • simplenews-newsletter-body.tpl.php (for all newsletters)
  • simplenews-newsletter-body--[newsletter_id].tpl.php
  • simplenews-newsletter-body--[view mode].tpl.php
  • simplenews-newsletter-body--[newsletter_id]--[view mode].tpl.php

Here's some news for the module developers: None of that exists in the D8 module! WTF, really? These are D7 instructions. Not very helpful esp since that README file contains some of the most complete and detailed instructions on this aspect of simplenews-- if you're using the D7 version, that is..

I have spent an all-nighter and several full days on configuring this. I'm using sipmplenews Version: 8.x-1.0-alpha2, mailsystem Version: 8.x-4.1, mimemail Version: 8.x-1.x-dev and smtp Version: 8.x-1.0-beta2. No matter what recipe I follow from the myriad of posts on this subject, this is what my HTML email messages look like when they arrive in my inbox: HTML tags visible and absolutely no formatting.

<h2>Testing 1234</h2> <span>Testing 1234</span> <div><div style="background: rgb(51, 102, 0) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"> <div style="color: #fff; text-align: center;">View this message in your browser <a href="http://example.com/phpList/archive/FTS-10-16-2016.htm" style="color: #fff;">HERE</a>.</div> <table border="1px solid" cellpadding="2" cellspacing="2" style="border-collapse: collapse; background-color: rgb(255, 255, 204); width: 75%; text-align: left; margin-left: auto; margin-right: auto; padding-top: 15px;"><tbody><tr><td style="background-image: url(http://example.com/sites/default/files/images/PosterBackground-web.jpg); width: 50%;"> <div style="text-align: center;"> <p><img src="http://example.com/sites/default/files/images/new-fot-logo-270-2.png" style="width: 85%; height: auto;" /></p> </div> </td> <td colspan="2"> <div style="float: right;"> <p><img alt="Skeeter Photo" src="http://example.com/sites/default/files/images/skeeter.image_.jpg" style="border: 1px solid ; margin: 4px; width: 50%; height: auto;" /><br /><small><small><b><small><small> MICHAEL “SKEETER” PILARSKI </small></small></b> </small></small></p> </div> <p> <a href="http://www.example.com"><img alt="Friends of the Trees Masthead" src="example.com/sites/default/files/images/top-fts.jpg" style="width: 100%` ... 

If anyone has this working or if there is a sympathetic developer out there, hear my plea: Someone please create a step-by-step basic simplenews configuration that anyone can follow to get simplenews to successfully send HTML formatted emails from a D8 website. If it was a configuration that was just enough to get it to work (with a designated theme and any other variables set), user customization could follow once a successful email has been sent This whole thing has worn me out.

2 Answers 2

6

Outdated documentation is one of the reasons why Simplenews is only in Alpha. Sorry you had a frustrating experience, but a lot of work of porting modules and writing documentation is done in (my) free time. It is one of the many contrib modules that I help maintain.

You're more than welcome to help improving the module and documention so the next person will be able to figure this out faster. Patches or simply by writing documentation on drupal.org.

The template extension is now .html.twig, which you should quickly see in the templates folder of the module.

Also, the very first paragraph on the project page contains this:

Simplenews publishes and sends newsletters to lists of subscribers. Both anonymous and authenticated users can opt-in to different mailing lists. HTML email can be sent by adding Mime Mail module for D7 and Swiftmailer for D8.

Swiftmailer requires a composer dependency and is a bit more complicated to install due to that, but it is what we've been using in our projects and should work well.

Also, make sure you enable HTML in the newsletter settings. And possibly try the latest dev versions if you have problems.

0
-1

Yes. Need to improve the module & Documentation. For HTML, Actually Simplenews module depends Swiftmailer and swiftmailer requires mailsystem module.

4
  • The simplenews module does NOT require switfmailer and the swiftmailer module does NOT require mimemail.
    – anonymous
    Jun 24, 2021 at 17:30
  • @anonymous, If we send the mail with HTML format, they said in that document needs to install Swiftmailer module for Drupal 8. If we install Swiftmailer the module it requires Mimemail module. See the documentation and check with .info.yml file. Jun 28, 2021 at 8:41
  • Nope. While you do need a helper module to send HTML email with Drupal, that helper module could be any one of a number of other modules, or could be your own custom code. If the Simplenews documentation suggests Swiftmailer as the helper module, that is only a suggestion, not a requirement. And Swiftmailer most certainly does NOT require Mime Mail - both Swiftmailer and Mime Mail do the same things, there is absolutely no need to use both at the same time. Perhaps you should take another look at swiftmailer.info.yml ...
    – anonymous
    Jun 28, 2021 at 17:18
  • @anonymous, Yes you are correct. I confused bit in between the Mailsystem & mime. Thanks for you info. Jun 29, 2021 at 6:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.