Hello,

I am using "mailsystem" in combination with "mimemail" and "simplenews". It seems I am missing something because my system keeps on sending plaintext newsletters - no matter what I do.

I installed "mailsystem" without pasting or adding any code. All I did was to set the pulldowns to "mimemail".

Are there any detailed instructions on how to get Drupal 7 to send out HTML emails? I found one but I do not know where to paste alt the the code?

Any help anyone?

Thanks,
Paul

Members fund testing for the Drupal project. Drupal Association Learn more

Comments

pillarsdotnet’s picture

Assigned: Unassigned » pillarsdotnet

Working on this.

pillarsdotnet’s picture

Project: Mail System » Mime Mail
Version: 7.x-2.26 » 7.x-1.x-dev
Assigned: pillarsdotnet » Unassigned
FileSize
20.58 KB
31.36 KB
21.65 KB
22.9 KB

Okay, I did the following, with screenshots:

  1. Set up a test server on http://example.com/d7
  2. Installed and configured Mail System, Mime Mail, and PHP Filter.
  3. Sent a test message by means of a custom PHP page
  4. Received the test message via Mozilla Thunderbird

If there is still a problem, I believe it is with Mime Mail and not with Mail System.

Redirecting.

pillarsdotnet’s picture

FileSize
29.14 KB

EDIT: ignore this.

pillarsdotnet’s picture

FileSize
24.85 KB

Sorry; the send_test_email.png screenshot was cut off by the overlay module.

Here is the code and a better screenshot:

$message = array(
  'headers' => array('Content-Type' => 'text/html'),
  'key' => 'test', 'to' => 'user@example.com', 'from' => 'user@example.com', 'subject' => 'Test email',
  'body' => '<h1>Test Email</h1></p>This is a test email with HTML formats and styling</p>
<dl><dt>Bulleted list</dt><dd><ul><li>Item one</li><li>Item two</li><li>Item three</li></ul></dd>
<dt>Ordered list</dt><dd><ol><li>Item one</li><li>Item two</li><li>Item three</li></ol></dd>
<dt>Table</dt><dd><table><thead><tr><th>Left column header</th><th>Right column header</th></tr></thead>
<tbody><tr><th>First row header</th><td>First row data</td></tr>
<tr><th>Second row header</th><td>Second row data</td></tr></tbody></table></dd></dl>';
$system = drupal_mail_system('test', 'test');
$system->format($message);
$result = $system->mail($message);
drupal_set_message('Test message ' . ($result ? 'sent' : 'not sent') . '.');
paul_constantine’s picture

Thank you for all your work.
I got it to work by installing HTMLmail and setting all the mails to HTML.

Best wishes,
Paul.

reptilex’s picture

Paul,
would you mind telling how did you do this? My Newsletters are really messed up. Tried Mime Mail, HTML Mail and plain text, none have a nice output.

Thanks for the help.

paul_constantine’s picture

Hi Reptilex,

I used trial & error until the HTML formatting got sent out. Here are the screenshots of the modules and the configuration I use.

Cheers,
Paul

hect0r’s picture

Hi,

I used the configuration of Paul, but it doesn't work for me : tags "h1", "h2", "ul", "li" are transformed in the mail received (see the screenshots).

Maybe I miss something ??

hect0r’s picture

Sorry, here are the screenshots.

paul_constantine’s picture

Hi Dlooc,

did you check the input formats you used to write your newsletter?

If you use "filtered HTML" or if your filters are set up in the wrong order they may be transforming your HTML tags into plaintext.

Try creating a new text format just for your newsletters and remove all filters.

Regards,
Paul

hect0r’s picture

Thanks for your help Paul,

My input format was "Full HTML" ;
I created a new format "Mail" (see the screenshots) but it doesn't solve the problem.
I don't understand what's wrong...

pillarsdotnet’s picture

The process of sending a Simplenews newsletter is fairly complicated.

See #1250240-1: How does HTML Mail render a Simplenews newsletter message?

hect0r’s picture

Thanks for these informations, it helps me to understand how works Simplenews.

My problem is more basic : my newsletter contains only a title and a body ; in the body, I have the HTML code :
<h1>Hello</h1>

but I receive a mail like this :

<p>======== HELLO ===============================================================</p>

I just want to use Simplenews with MimeMail, as it is recommended on the project page "http://drupal.org/project/simplenews", to send a message using HTML format. This configuration worked fine on Drupal 6.

Is there any subtlety to configure MimeMail and MailSystem, or may I use the module MailMime to replace MimeMail ?

pillarsdotnet’s picture

Mailmime definitely does not replace Mimemail

I'm sorry for the confusingly similar naming. MailMIME is named after the PEAR class that it wraps. It does not send mail.

Your output shows that something is calling drupal_html_to_text().

Hopefully the MimeMail maintainers can chime in here, but possibly you need to check your MailSystem settings and make sure that the default Mail System is set to MimeMailSystem.

One way to do this is to visit admin/config/system/mailsystem.

Another way is to uninstall and reinstall MimeMail.

hect0r’s picture

FileSize
65.45 KB

Thanks a lot for your help.

So I uninstalled and reinstalled MimeMail (version 7.x-1.x-dev from 2011-Jul-30), then I put the MailSystem settings :

- Site-wide default MailSystemInterface class => MimeMailSystem
- Mime Mail module class => MimeMailSystem
- Simplenews module class => MimeMailSystem (I tried too with DefaultMailSystem)

Unfortunately, it doesn't solve the problem.

hect0r’s picture

Category: support » bug

ok, I think it's a bug : I installed a new fresh Drupal 7.7 with only these modules :
- mimemail 7.x-1.x-dev (2011-jui-30)
- simplenews 7.x-1.x-dev (2011-juin-12)
- Mail System 7.x-2.28

In the body of my newsletter (with text format : full HTML), I put these tags :

<h1>Hello</h1>
<h3>Content</h3>
<h2>Bye</h2>

And I obtained this in the source of the mail received :

<div class="htmlmail-simplenews-body htmlmail-body">
-------- TEST N°12 ----------------------------------------------------------
<p>======== HELLO ===============================================================</p>
<p>.... Content</p>
<p>-------- BYE -----------------------------------------------------------------</p>

I tried to add the module "htmlmail" (version 7.x-2.60) but it doesn't solve the problem.

If any MimeMail maintainer could look at this, I would be very grateful.

sgabe’s picture

I cannot reproduce this. I don't use HTML Mail, as far as I know Mime Mail and HTML Mail are incompatible with each other. However your settings seem to be right.

I think you forgot to set HTML format for your newsletter category at /admin/structure/simplenews. It is not enough to set the default settings, perhaps this is a bug in Simplenews.

I too created a fresh install with just the needed modules (MailSystem, MimeMail, Simplenews and nothing else) and it works fine.

hect0r’s picture

FileSize
53.16 KB
24.75 KB
37.37 KB
26.82 KB

Thanks for your help, sgabe. You are right : the problem results from the Simplenews category.

When you install the Simplenews module for the first time, a Simplenew category is automatically created (in the table "simplenews_category") with a format "plain text", and you have to change it after the installation.

But if you have installed the "Admin menu" Module, you can't edit the Simplenews categories : the menu "Structure > Newsletters" has only one item : "Add Newsletter category" (see the screenshots).

You can change the format using the menu "Structure > Taxonomy > Newsletter" but this affects the field "format" of the table "taxonomy_term_data" and not the field "format" of the table "simplenews_category".

sgabe’s picture

So is this a Simplenews or an Admin Menu bug? Please move the issue to the right place.

hect0r’s picture

Maybe a Simplenew bug ? I move this issue on Simplenews issues (http://drupal.org/node/1268160).
I solved the problem using the Drupal standard administration menu instead of "Admin menu" module.

sgabe’s picture

Status: Active » Closed (duplicate)

You could have just changed this issue's settings. However I think this can be closed as a duplicate of #1268160: Bug with Simplenews and Admin Menu

snehal.addweb’s picture

Issue summary: View changes
Priority: Normal » Critical
Status: Closed (duplicate) » Fixed

Hey Guys,

Cracked it!!

Have alook and save your time..Enjoy!!!!!

Using "mailsystem" in combination with "mimemail" and "simplenews":

Try following option(s)/method to check E-mail format as HTML:

1. configuration > system > mail system
or
admin/config/system/mimemail

2. configuration > web services > newsletters > settings
or
admin/config/services/simplenews/settings

3. configuration > webservices > edit newsletter category (of the newsletter in question)
or
admin/config/services/simplenews/categories/**/edit
(** = the taxonomy category number that the newsletter is using)

Happy Drupaling!!!!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.