stalwartlabs / mail-send

E-mail delivery library for Rust with DKIM support
https://docs.rs/mail-send/
Apache License 2.0
206 stars 21 forks source link

Derive Clone for mail_send::smtp::message::{Message, Address, Parameters, Parameter}. #33

Closed janis-ab closed 5 months ago

janis-ab commented 5 months ago

At the moment SmtpClient::send takes impl IntoMessage as an argument, thus it takes ownership of a message and in times when message sending fails and it is necessary to retry sending the same message a bit later, it is not possible to do so, because it has been moved.

This is why we #[derive(Clone)] for Message, Address, Parameters, Parameter.

Now it is possible to clone message before sending it. On success we can drop the original, on retry cases we can clone original again, update some parameters and resend.