Display error message instead of blank/error page
andreiashu - June 23, 2009 - 14:43
| Project: | PHPMailer |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Drupal 6 lets you register users with email formats like this: andrei+test1@gmail.com. But there are some mail servers that don't let you send emails that have the "To" or "From" field like that(ex. relay.plus.net).
When I try to send emails that have that particular format I get a blank page (if "Debug level" is set to disabled) or this (when "debug level" is set to Full Communication):
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "220 relay.plus.net ESMTP Exim Tue, 23 Jun 2009 15:27:30 +0100 "
SMTP -> get_lines(): $data is "220 relay.plus.net ESMTP Exim Tue, 23 Jun 2009 15:27:30 +0100 "
SMTP -> FROM SERVER:220 relay.plus.net ESMTP Exim Tue, 23 Jun 2009 15:27:30 +0100
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "250-ptb-relay01.plus.net Hello sub.mywebsite.co.uk [80.229.185.190] "
SMTP -> get_lines(): $data is "250-ptb-relay01.plus.net Hello sub.mywebsite.co.uk [80.229.185.190] "
SMTP -> get_lines(): $data was "250-ptb-relay01.plus.net Hello sub.mywebsite.co.uk [80.229.185.190] "
SMTP -> get_lines(): $str is "250-SIZE 104857600 "
SMTP -> get_lines(): $data is "250-ptb-relay01.plus.net Hello sub.mywebsite.co.uk [80.229.185.190] 250-SIZE 104857600 "
SMTP -> get_lines(): $data was "250-ptb-relay01.plus.net Hello sub.mywebsite.co.uk [80.229.185.190] 250-SIZE 104857600 "
SMTP -> get_lines(): $str is "250-PIPELINING "
SMTP -> get_lines(): $data is "250-ptb-relay01.plus.net Hello sub.mywebsite.co.uk [80.229.185.190] 250-SIZE 104857600 250-PIPELINING "
SMTP -> get_lines(): $data was "250-ptb-relay01.plus.net Hello sub.mywebsite.co.uk [80.229.185.190] 250-SIZE 104857600 250-PIPELINING "
SMTP -> get_lines(): $str is "250-AUTH PLAIN LOGIN "
SMTP -> get_lines(): $data is "250-ptb-relay01.plus.net Hello sub.mywebsite.co.uk [80.229.185.190] 250-SIZE 104857600 250-PIPELINING 250-AUTH PLAIN LOGIN "
SMTP -> get_lines(): $data was "250-ptb-relay01.plus.net Hello sub.mywebsite.co.uk [80.229.185.190] 250-SIZE 104857600 250-PIPELINING 250-AUTH PLAIN LOGIN "
SMTP -> get_lines(): $str is "250 HELP "
SMTP -> get_lines(): $data is "250-ptb-relay01.plus.net Hello sub.mywebsite.co.uk [80.229.185.190] 250-SIZE 104857600 250-PIPELINING 250-AUTH PLAIN LOGIN 250 HELP "
SMTP -> FROM SERVER: 250-ptb-relay01.plus.net Hello sub.mywebsite.co.uk [80.229.185.190] 250-SIZE 104857600 250-PIPELINING 250-AUTH PLAIN LOGIN 250 HELP
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "501 <"andrei" >: "@" or "." expected after ""andrei"" "
SMTP -> get_lines(): $data is "501 <"andrei" >: "@" or "." expected after ""andrei"" "
SMTP -> FROM SERVER:501 <"andrei" >: "@" or "." expected after ""andrei""
SMTP -> ERROR: MAIL not accepted from server: 501 <"andrei" >: "@" or "." expected after ""andrei"" Another important thing is that PHPMailer doesn't log these errors to watchdog.
Can PHPMailer just display an error message on the page (and log it to watchdog) instead of just crashing like this ?
Would it be possible to have the same behavior (ie. not crashing) when the server responds with an unsuccessful message ?
Thanks for this nice module !
Cheers

#1
I think the issue of the WSOD has been addressed in the latest development snapshot. That said, the error handling of the PHPMailer class still sucks, and I doubt there is much that we can do about it. For example, there is no way to tell PHPMailer to just skip over invalid (or expired, see similar issue #551004: Blank screen & cron can't run on failed recipient Fatal Error) recipients, as it will *always* terminate the e-mail delivery.
Correction: This only applies to the From address, invalid recipients are actually skipped over.
#2
Automatically closed -- issue fixed for 2 weeks with no activity.