Currently if there is an exception you get something like:

Fatal error: Uncaught exception 'Exception' with message 'Error while mailing. Postmark returned HTTP code 422 with message "Sender signature not found for email."' in /vol/drupal/6_drupal/sites/all/modules/postmark/includes/Postmark.php:276 Stack trace: #0 /vol/drupal/6_drupal/sites/all/modules/postmark/includes/postmark.drupal.inc(66): Mail_Postmark->send() #1 /vol/drupal/6_drupal/sites/all/modules/postmark/postmark.module(46): postmark_send(Array) #2 /vol/drupal/6_drupal/includes/mail.inc(177): drupal_mail_wrapper(Array) #3 /vol/drupal/6_drupal/includes/mail.inc(130): drupal_mail_send(Array) #4 /vol/drupal/6_drupal/sites/all/modules/project_issue/includes/mail.inc(278): drupal_mail('project_issue', 'project_issue_u...', 'ezra@example.com......', Object(stdClass), Array, '"ben (Project -...') #5 /vol/drupal/6_drupal/sites/all/modules/project_issue/project_issue.module(856): project_mail_notify('4217') #6 [internal function]: project_issue_exit('http://project....') #7 /vol/drupal/6_drupal/includes/module.inc(483): call_user in /vol/drupal/6_drupal/sites/all/modules/postmark/includes/Postmark.php on line 276

It would be nice if the module could catch exceptions, log them to watchdog as php errors, and allow the page processing to continue.

Comments

cyberwolf’s picture

Subscribing.

luketsimmons’s picture

Assigned: Unassigned » luketsimmons

Hi greggles,

Agreed, was definitely on my todo list to look at catching the exceptions and getting them into watchdog.

The actual output you've got there is a PHP error though, so it's showing the exception and the Xdebug stack trace output, so the exceptions are much shorter normally, we'd be storing something like this in watchdog -

Error while mailing. Postmark returned HTTP code 422 with message "Sender signature not found for email."

Which comes from the postmark.php class, I'll have a look at this and get something added in.

Thanks,

Luke

luketsimmons’s picture

Had a look at this and think I've got the catching of exception set up OK now.

Basically the only throwing of exceptions happens in the send() method, so I've set up the $mail->send() to catch the exceptions and use them properly.

I've also moved the full print_r() of the exception to watchdog if debugging is switched on, to save from unnecessary watchdogging (not the best verb).

I've also added tidier drupal_set_messages, including one for if the value for "no credit use" is switched on, i.e. the script sends no emails, just returns TRUE.

Once again will roll these into next release once I've heard about the Postmark include.

Thanks,

Luke

zilverdistel’s picture

subscribing, I also get this message when the module is disabled. Should I uninstall it to get rid of the messages?

luketsimmons’s picture

Status: Active » Needs review

OK I've sorted this and it's available in the latest release.

zilverdistel - as per the other issue related to your point #1004340: When postmark is disabled, drupal still tries to send email through postmark I've modified the disable/enabled checking for smtp_library, so you shouldn't get this anymore as if the module is disabled then the SMTP being used should be the default library not Postmark.

greggles’s picture

We're now testing this out using the tip of the 6.x-1.x branch from git.

ressa’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

Since Drupal 6 is EOL a long time ago, I am closing this. Feel free to re-open if still relevant.