Open Bug 599890 Opened 16 years ago Updated 11 years ago

Do not throw an error if Bugzilla fails to send a message to some email recipient

Categories

(Bugzilla :: Email Notifications, defect)

3.6.2
defect
Not set
normal

Tracking

()

People

(Reporter: LpSolit, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

At GCC, we have a problem with one email recipient. This makes SMTP to fail to send messages to it, but all other recipients are working fine. In Bugzilla::Mailer::MessageToMTA(), we explicitly throw an error if the email cannot be sent: my $retval = $mailer->send($email); ThrowCodeError('mail_send_error', { msg => $retval, mail => $email }) if !$retval; This prevents other email notifications from being sent, and some bugs cannot be updated correctly. As user lambda cannot do anything about this, we should rather notify the maintainer about this problem (once per bug), but not throw an error. In that case, lastdiffed shouldn't be updated if we return $retval = 0, so that we give Bugzilla a chance to retry later (some users would get the bugmail twice, but that's already the case currently anyway).
I think that instead, that particular user shouldn't get this bugmail at all. However, it's also very common that errors occur because the SMTP server is totally unavailable or there's some general problem with the mail system, in which case we don't want to update lastdiffed. That's why I filed this bug: https://rt.cpan.org/Ticket/Display.html?id=21990 But the response is that we should be using Email::Sender instead of Email::Send, so that would be the first step.
(In reply to comment #1) > But the response is that we should be using Email::Sender instead of > Email::Send, so that would be the first step. For now, it's easier to not throw an error. lastdiffed isn't and won't be updated with my proposal. Using Email::Sender won't fix the problem I describe: we shouldn't call ThrowCodeError() at all.
Attached patch patch, v1 (obsolete) — — Splinter Review
Assignee: email-notifications → LpSolit
Status: NEW → ASSIGNED
Attachment #483788 - Flags: review?(mkanat)
Attached patch patch, v2 — — Splinter Review
Better patch: we now highlight recipients which didn't get bugmail, and ask the user to inform the maintainer.
Attachment #483788 - Attachment is obsolete: true
Attachment #483790 - Flags: review?(mkanat)
Attachment #483788 - Flags: review?(mkanat)
Ah, the advantage of Email::Sender is that we should be able to tell the difference between an MTA misconfiguration and just the fact that one individual recipient failed. I think that it would also make the above patch much simpler, and the patch seems like it adds quite a bit of complexity just to manage this problem. Also, if we move this information to the "Email sent" section, then we are making ourselves dependent upon the existence of that section for all installations, into the future. There has been some debate about whether or not that section is even useful for all users, so I'm not sure that we want to do that. Note that currently, the problem is also entirely handled if you use jobqueue.pl, since all that will happen is the individual job will fail. (This also means that it's important that the job does actually throw an error if it fails.) So I'd tend to say that if people want to avoid this problem currently, they should be using jobqueue.pl.
Assignee: LpSolit → email-notifications
Status: ASSIGNED → NEW
Comment on attachment 483790 [details] [diff] [review] patch, v2 OK, I agree that my patch as is looks more like a hack than a real fix.
Attachment #483790 - Flags: review?(mkanat)
Since I filed this bug, we moved to Email::Sender and we have the mail_staging table to store pending bugmails. As Email::Sender is able to distinguish a permanent error from a temporary one, what we should do is: - if it's a permanent error (e.g. the email address no longer exists), bugmails should be automatically disabled for this account, the current email should be silently deleted and no error should be thrown. - if it's a temporary error, then the email should be silently moved back into the mail_staging table so that Bugzilla can retry later to send it again. In both cases, no error should be thrown, especially because the user cannot do anything about it. What would be good to have also is an additional column in the mail_staging table to count how many times Bugzilla tried to send each email. It would probably be good also to know when was the last attempt, to limit how often Bugzilla tries to resend it.
(In reply to Frédéric Buclin from comment #11) > - if it's a permanent error (e.g. the email address no longer exists), > bugmails should be automatically disabled for this account, the current > email should be silently deleted and no error should be thrown. We would want some way for an admin or someone else viewing the account to know what had happened here. Can we have an account_mail_error column in the user table or something, which contains the text of the error? Gerv
(In reply to Gervase Markham [:gerv] from comment #12) > We would want some way for an admin or someone else viewing the account to > know what had happened here. Can we have an account_mail_error column in the > user table or something, which contains the text of the error? Hum, no need for a separate column. Just use the error message for the disabledtext. This way, the user himself will know why he cannot use this email address anymore.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: