When sending mail fails because of invalid address, the mail is not discarded

Bug #731029 reported by François Marier
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Richard Mansfield

Bug Description

If a user registers with an email address like "person@gmail" (invalid domain), the validation doesn't catch that (see bug #731028) but more importantly, the notice below is sent over and over again to the site admin.

We need to make sure that when phpmailer fails for this reason, the email is forever dropped and so only one such notice will be sent to the site admin.

-----Original Message-----
From: Example Site [ mailto:<email address hidden>]
Sent: Tuesday, 8 March 2011 9:25 a.m.
To: Site Admin
Subject: Example Site: User notification error was probably caused by your server configuration.

You have been sent a notification from Example Site. Message follows:
------------------------------------------------------------------------

Subject: User notification error was probably caused by your server
configuration.

exception 'EmailException' with message 'Couldn't send email to FirstName LastName
with subject Example Site: New page access. Error from phpmailer was:
You must provide at least one recipient email address.' in
/var/www/mahara/lib/user.php:439
Stack trace:
#0 /var/www/mahara/notification/email/lib.php(89):
email_user(Object(stdClass), NULL, 'Example Site...', 'You have been s...',
NULL, NULL)
#1 [internal function]: PluginNotificationEmail::notify_user(Object(stdClass),
Object(stdClass))
#2 /var/www/mahara/lib/mahara.php(1176):
call_user_func_array(Array, Array)
#3 /var/www/mahara/lib/activity.php(447):
call_static_method('PluginNotificat...', 'notify_user', Object(stdClass),
Object(stdClass))
#4 /var/www/mahara/lib/activity.php(473):
ActivityType->notify_user(Object(stdClass))
#5 /var/www/mahara/lib/activity.php(82):
ActivityType->notify_users()
#6 /var/www/mahara/lib/activity.php(214):
handle_activity('5', Object(stdClass), true)
#7 /var/www/mahara/lib/cron.php(149):
activity_process_queue()
#8 {main}

------------------------------------------------------------------------

This is an auto generated notification from Example Site. To update your
notification preferences, visit
http://example.com/account/activity/preferences/

Please do not reply to this message.

Changed in mahara:
status: Confirmed → Fix Committed
assignee: nobody → Richard Mansfield (richard-mansfield)
Revision history for this message
Richard Mansfield (richard-mansfield) wrote :

I don't think the admin needs to know about attempts to send to invalid email addresses, so I've just thrown a different class of exception in that case and ignored them in notify_user().

It was done like this already with EmailDisabled exceptions, but maybe we should have a think about which exceptions *should* bother the admin, rather than assuming they all should bother the admin by default.

Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.