← Back to team overview

mahara-contributors team mailing list archive

[Bug 731029] Re: When sending mail fails because of invalid address, the mail is not discarded

 

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.

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
https://bugs.launchpad.net/bugs/731029

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

Status in Mahara ePortfolio:
  Fix Committed

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:noreply@xxxxxxxxxxx]
  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.



References