File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -263,7 +263,7 @@ async fn smtp_send(
263263 smtp. last_send_error = send_result. as_ref ( ) . err ( ) . map ( |e| e. to_string ( ) ) ;
264264
265265 let status = match send_result {
266- Err ( crate :: smtp :: send:: Error :: SmtpSend ( err) ) => {
266+ Err ( send:: Error :: SmtpSend ( err) ) => {
267267 // Remote error, retry later.
268268 info ! ( context, "SMTP failed to send: {:?}." , & err) ;
269269
@@ -345,13 +345,7 @@ async fn smtp_send(
345345
346346 res
347347 }
348- Err ( crate :: smtp:: send:: Error :: Envelope ( err) ) => {
349- // Local error, job is invalid, do not retry.
350- smtp. disconnect ( ) ;
351- warn ! ( context, "SMTP job is invalid: {err:#}." ) ;
352- SendResult :: Failure ( err)
353- }
354- Err ( crate :: smtp:: send:: Error :: Other ( err) ) => {
348+ Err ( send:: Error :: Other ( err) ) => {
355349 // Local error, job is invalid, do not retry.
356350 smtp. disconnect ( ) ;
357351 warn ! ( context, "Unable to load SMTP job: {err:#}." ) ;
Original file line number Diff line number Diff line change 11//! # SMTP message sending
22
3+ use anyhow:: Context as _;
34use async_smtp:: { EmailAddress , Envelope , SendableEmail } ;
45
56use super :: Connection ;
@@ -11,8 +12,6 @@ pub type Result<T> = std::result::Result<T, Error>;
1112
1213#[ derive( Debug , thiserror:: Error ) ]
1314pub enum Error {
14- #[ error( "Envelope error: {}" , _0) ]
15- Envelope ( anyhow:: Error ) ,
1615 #[ error( "Send error: {}" , _0) ]
1716 SmtpSend ( async_smtp:: error:: Error ) ,
1817 #[ error( "{}" , _0) ]
@@ -35,8 +34,8 @@ impl Connection {
3534 context. ratelimit . write ( ) . await . send ( ) ;
3635 }
3736
38- let envelope =
39- Envelope :: new ( Some ( self . from . clone ( ) ) , recipients . to_vec ( ) ) . map_err ( Error :: Envelope ) ?;
37+ let envelope = Envelope :: new ( Some ( self . from . clone ( ) ) , recipients . to_vec ( ) )
38+ . context ( " Envelope error" ) ?;
4039 let mail = SendableEmail :: new ( envelope, message) ;
4140
4241 self . transport . send ( mail) . await . map_err ( Error :: SmtpSend ) ?;
You can’t perform that action at this time.
0 commit comments