I've installed HTML mail, simplenews and SMTP Authentication support. The test email from SMTP Auth works fine but if I try to send a newsletter from simplenews, all I get is plain text. If I pick any mail systems settings but SMTPMailSystem the emails won't send. Any ideas what I'm doing wrong?

Thanks
Sharon

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Darkplek’s picture

It sounds like I have the same problem (sorry I can't actually help!)

I'm using this module to allow me to test email whilst developing on localhost, currently. I'm using Ubercart, which defines HTML templates for emails that get used by default. When using this module all that is actually sent is a big mash of plain text with all the html removed....

I'd appreciate any suggestions, quite urgently.

pillarsdotnet’s picture

Project: SMTP Authentication Support » Mail System
Version: 7.x-1.x-dev » 7.x-2.x-dev
Component: Miscellaneous » Code
Assigned: Unassigned » pillarsdotnet

So you're using HTMLMailSystem for formatting but SMTPMailSystem for sending?

SharonD214@aol.com’s picture

Well, I wasn't but tried setting it this way and now get the following error message:

Fatal error: require_once() [function.require]: Failed opening required 'C:\wamp\www\drupal/C:\wamp\www\drupal\sites\nabn\files\mailsystem/HTMLMailSystem__SmtpMailSystem.mail.inc' (include_path='.;C:\php\pear') in C:\wamp\www\drupal\includes\bootstrap.inc on line 2724

Any idea how to fix this? I get the same message if I try to configure HTML Mail, Mail System or SMTP Authentication Support

Sharon

SharonD214@aol.com’s picture

ok, Tossed the mailsystem folder and at least I'm not getting the error message on every page any more, but what I had was site-wide default as SMTPMailSystem and HTMLMAilSystem or SMTPMAilsystem as the HTML Mail Module class set in the Mail system.

Sharon

pillarsdotnet’s picture

Category: support » bug
Status: Active » Needs work

That error is due to a bug in Mail System module. I'm working on it; thanks.

pillarsdotnet’s picture

Status: Needs work » Needs review

Fixed in 7.x-2.27 release, I hope. Please test, as I don't have a Windows system to verify.

SharonD214@aol.com’s picture

Be glad to, Mail will not send from localhost, unless I have site-wide default and HTML mail module class set to SMTPMailSystem - and then it is only plain text when sending HTML mail test email. Should I set something under new class and new setting or does HTML mail not work locally?

Sharon

pillarsdotnet’s picture

Okay, thoroughly tested this and found errors in all three participating modules.

Fixed in Mail System 7.x-2.28 and HTML Mail 7.x-2.58.

Had to patch SMTP Authentication Support. See #1199966-1: The Content-Type header is incorrectly parsed in SmtpMailSystem::mail() function.

The enclosed screenshots show how I configured a test system to format mails using HTML Mail and send them using SMTP Authentication Support.

pillarsdotnet’s picture

Title: HTML mail sends a plain text » Messages formatted with HTML Mail and sent with SMTP are received as plain text.
pillarsdotnet’s picture

Missed a screenshot in the above list.

pillarsdotnet’s picture

Created a documentation page listing all the steps required to get this working.

SharonD214@aol.com’s picture

ok - I updated a patched everything as noted in #8. I don't have Mail MIME or Include modules installed (not sure if I need them for it to work properly, if so I'll install them). All the other modules are installed. I tried setting up the mail_system as noted and got the followin message

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'HTMLMailSystem__SmtpMailSystem-class' for key 'PRIMARY': INSERT INTO {registry} (name, type, filename, module, weight) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => HTMLMailSystem__SmtpMailSystem [:db_insert_placeholder_1] => class [:db_insert_placeholder_2] => sites\nabn\files\mailsystem\HTMLMailSystem__SmtpMailSystem.mail.inc [:db_insert_placeholder_3] => mailsystem [:db_insert_placeholder_4] => 0 ) in _registry_parse_file() (line 179 of C:\wamp\www\drupal\includes\registry.inc).
The website encountered an unexpected error. Please try again later.

and then when trying to go to any other page I get:

Fatal error: require_once() [function.require]: Failed opening required 'C:\wamp\www\drupal/C:\wamp\www\drupal\sites\nabn\files\mailsystem/HTMLMailSystem__SmtpMailSystem.mail.inc' (include_path='.;C:\php\pear') in C:\wamp\www\drupal\includes\bootstrap.inc on line 2724

until I deleted the mailsystem folder from my files folder

Thanks
Sharon

pillarsdotnet’s picture

Status: Fixed » Postponed (maintainer needs more info)

There is a record in your registry that has a bad path.

Running the following code from PHP filter should clear up the problem:

db_query('DELETE FROM {registry} WHERE filename LIKE "%mailsystem%"');
db_query('DELETE FROM {registry_files} WHERE filename LIKE "%mailsystem%"');
registry_rebuild(); 

While slightly more drastic, the following should also work:

db_query('DELETE FROM {registry}');
db_query('DELETE FROM {registry_files}');
registry_rebuild();
SharonD214@aol.com’s picture

ok, I've removed the offending issue from the registry and have everything setup as shown above, but after trying to send the test email from HTML mail, I get the following messages and no email is received.

HTML Mail test message sent.
Error message Unable to send e-mail. Contact the site administrator if the problem persists.

However test email from SMTP auth works fine and is HTML formatted.

Sharon

pillarsdotnet’s picture

Did you select the HTMLMailSystem__SmtpMailsystem class for both site-wide (Default) and HTML Mail as shown in the screenshot?

SharonD214@aol.com’s picture

yes, I did.

Sharon

pillarsdotnet’s picture

I'm glad that this is mostly working for you. You've been a tremendous help so far. Could you please check your watchdog log for any clue as to why the HTML Mail test message did not send, and paste the results here? I'd like to fix that last little problem if I can.

SharonD214@aol.com’s picture

Here's what I've got from my dblog

TYPE mail
DATE Monday, June 27, 2011 - 19:40
USER SharonD214
LOCATION http://nabn/drupal/admin/config/system/htmlmail/test?render=overlay&rend...
REFERRER http://nabn/drupal/admin/config/system/htmlmail/test?render=overlay
MESSAGE Error sending e-mail (from xx@aol.com to xx@aol.com).
SEVERITY error
HOSTNAME 127.0.0.1
OPERATIONS

Hope this helps.

Sharon

pillarsdotnet’s picture

Can you also check the "debug" box in the SMTP module settings page and try again?

SharonD214@aol.com’s picture

ok -
The log message is the same except the location and referrer end at "test". Any place else I should be looking?

Sharon

pillarsdotnet’s picture

Weird. So... I wonder where the error message is coming from? Because if SMTP is producing the error, then you should see a whole BUNCH of screen output. And if HTML Mail is producing the error, then MailSystem is not doing its job.

My dblog normally reports a filename and line number. Yours obviously works differently. Are you logging to database or syslog? Can you try with overlay turned off?

SharonD214@aol.com’s picture

I used Komodo Edit to search for the error message. It is coming from line 156 of mail.inc that resides in my drupal\includes folder. I'm not sure how my system is logging errors,

I'm kind of new to drupal and haven't set that up. I just looked in the reports section and selected recent log messages and that is what I see. My logging and errors section is supposed to record all errors and up to 1000 log messages, but I don't see any filename and line numbers. I usually get a filename and line number on the page where there is an error but no with this one.

No change when turning noff the overlay.

Sharon

pillarsdotnet’s picture

I want to thank you for your patience and determination to see this through. I'm still trying to figure out why, but it's definitely HTML Mail that is failing to send, whereas SMTP should be handling the sending.

Here is a patched version of HTML Mail that provides better debugging in case of message failure. Could you try using it, and then pasting the resultant watchdog message here?

Thanks so very much. I wouldn't be able to troubleshoot this on my own.

SharonD214@aol.com’s picture

FileSize
461.17 KB

ok - It's really long and I've edited some client info and emails out and attached as a file. There is also another issue. When registering a new user I'm getting the original email message to be emailed followed by:

To customize this message:

For module-specific customization, copy
sites/all/modules/htmlmail/htmlmail.tpl.php
to
sites/default/themes/default/htmlmail--user.tpl.php

For message-specific customization, copy
sites/all/modules/htmlmail/htmlmail.tpl.php
to
sites/default/themes/default/htmlmail--user--register_pending_approval.tpl.php

Edit the copied file.

Send a test message to make sure your customizations worked.

If you think your customizations would be of use to others, please contribute your file as a feature request in the issue queue.

The user module sets the $params variable. For this message,

$params =

( ! ) Fatal error: Nesting level too deep - recursive dependency? in C:\wamp\www\drupal\sites\default\themes\default\htmlmail.tpl.php on line 170
Call Stack
# Time Memory Function Location
1 0.0017 401616 {main}( ) ..\index.php:0
2 2.4216 35177816 menu_execute_active_handler( ) ..\index.php:21
3 2.4219 35178304 call_user_func_array ( ) ..\menu.inc:503
4 2.4219 35178488 drupal_get_form( ) ..\menu.inc:0
5 2.4219 35178952 drupal_build_form( ) ..\form.inc:187
6 2.4355 35849848 drupal_process_form( ) ..\form.inc:349
7 2.5899 38830720 form_execute_handlers( ) ..\form.inc:829
8 2.5899 38835816 logintoboggan_user_register_submit( ) ..\form.inc:1389
9 6.3617 57309552 _user_mail_notify( ) ..\logintoboggan.module:521
10 6.3618 57311088 drupal_mail( ) ..\user.module:3430
11 6.4025 57315712 HTMLMailSystem__SmtpMailSystem->format( ) ..\mail.inc:147
12 6.4026 57315712 HTMLMailSystem->format( ) ..\HTMLMailSystem__SmtpMailSystem.mail.inc:20
13 6.4028 57317696 theme( ) ..\htmlmail.mail.inc:51
14 6.4041 57351280 theme_render_template( ) ..\theme.inc:937
15 6.4352 57428184 include( 'C:\wamp\www\drupal\sites\default\themes\default\htmlmail.tpl.php' ) ..\theme.inc:1247
16 6.4367 57429024 var_export ( ) ..\htmlmail.tpl.php:170

This is supposed to redirect to a paypal page and was working fine before - no email is sent either

Sharon

SharonD214@aol.com’s picture

One other thing, in the Mail system configuration, the HTML module class does not remain set at HTMLMailsystem_SmtpMailSystem, but switches itself back to HTMLMail system.

Sharon

pillarsdotnet’s picture

Status: Postponed (maintainer needs more info) » Active

The current version of htmlmail.tpl.php uses print_r() instead of var_export() in order to avoid this kind of fatal error.

The debug checkbox is causing the extra information to be printed. You can disable it by visiting your HTML Mail settings page at admin/config/system/htmlmail.

Please also visit your Mail System settings page at admin/config/system/mailsystem and make sure that the HTMLMailSystem__SmtpMailSystem class is specified for all $module/$key combinations. Based on the information you provided, I believe that HTMLMailSystem is currently specified for htmlmail/test. This would explain why your test messages are not being sent via SMTP.

I'm sorry that the debugging output was unnecessarily verbose, but I wanted to make sure I got enough information. I'll be releasing a new version of HTML Mail shortly incorporating some of the improvements related to this issue.

Again, do please un-check the "Debugging" option in both HTML Mail and SMTP Authentication Support in order to get your emails working properly.

Thank you very much for helping to make this module better for everybody.

pillarsdotnet’s picture

Project: Mail System » HTML Mail
Category: bug » support
Status: Active » Fixed
SharonD214@aol.com’s picture

Hmm, updated to 7.x-2.59 release and got the following

( ! ) Parse error: syntax error, unexpected '}' in C:\wamp\www\drupal\sites\all\modules\htmlmail\htmlmail.mail.inc on line 283
Call Stack
# Time Memory Function Location
1 0.0028 367464 {main}( ) ..\index.php:0
2 0.0197 908480 drupal_bootstrap( ) ..\index.php:20
3 0.1744 6137592 _drupal_bootstrap_full( ) ..\bootstrap.inc:1934
4 1.0516 34212496 module_invoke_all( ) ..\common.inc:4937
5 1.0610 34392520 call_user_func_array ( ) ..\module.inc:819
6 1.0610 34392656 mailsystem_init( ) ..\module.inc:0
7 1.0610 34392656 mailsystem_get_classes( ) ..\mailsystem.module:17
8 1.0804 34632456 drupal_autoload_class( ) ..\mailsystem.module:286
9 1.0804 34632504 _registry_check_code( ) ..\bootstrap.inc:2649
10 1.0804 34632536 class_exists ( ) ..\bootstrap.inc:2669
11 1.0804 34632752 drupal_autoload_class( ) ..\bootstrap.inc:0
12 1.0804 34632800 _registry_check_code( ) ..\bootstrap.inc:2649

Sharon

pillarsdotnet’s picture

The previous line is lacking a semicolon. (sigh)

Fixing...

pillarsdotnet’s picture

Released 6.x-2.60 / 7.x-2.60 / 8.x-2.60.

SharonD214@aol.com’s picture

Works!, now I just need to format my theme properly :)

Thanks
Sharon

pillarsdotnet’s picture

Yay!!!!!

(/me does the happy-dance)

Status: Fixed » Closed (fixed)

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