-
Notifications
You must be signed in to change notification settings - Fork 684
Description
Recently, we got some reports of email verification emails not arriving. We looked in mailgun for error reports, but there weren't any logs associated with the email addresses in mailgun's logs, so it seemed like the emails didn't even get to mailgun.
We didn't have any errors in our logs, so we didn't really have much more visibility into any potential problems.
To help debug future problems around email sending, it would be nice if we had logging of:
- Successful email send request, including the mailgun ID
- Failure of email send request, including any error messages
Email sending is around here:
Lines 104 to 115 in dd9893b
| EmailBackend::Smtp { | |
| server, | |
| login, | |
| password, | |
| } => { | |
| SmtpTransport::relay(server)? | |
| .credentials(Credentials::new(login.clone(), password.clone())) | |
| .authentication(vec![Mechanism::Plain]) | |
| .build() | |
| .send(&email) | |
| .map_err(|_| server_error("Error in sending email"))?; | |
| } |
I'm not sure what lettre exposes or what mailgun responds with.
This is related to #4596, in that in production the email backend should always be Smtp, so perhaps the Env enum can be used in the sending code as well to ensure this.
cc @rust-lang/crates-io-on-call, this would be super helpful for production support.