[][src]Function mail_smtp::send_batch

pub fn send_batch<A, S, C>(
    mails: Vec<MailRequest>,
    conconf: ConnectionConfig<A, S>,
    ctx: C
) -> impl Stream<Item = (), Error = MailSendError> where
    A: Cmd,
    S: SetupTls,
    C: Context

Sends a batch of mails to a server.

  • This will use the given context to encode all mails.
  • After which it will use the connection config to open a connection to the server (like a Mail Submission Agent (MSA)).
  • Then it will start sending mails.
    • If a mail fails because of an error code but setting up the connection (which includes auth) didn't fail then others mails in the input will still be send
    • If the connection is broken because setting it up failed or it was interrupted, then the mail at which place it was noticed will return the given error and all later mails will return a I/0-Error with the ErrorKind::NoConnection
  • It will return a Stream which when polled will send the mails and return results in the order the mails had been supplied. So for each mail there will be exactly one result.
  • Once the stream is completed the connection will automatically be closed (even if the stream is not yet dropped, it closes it the moment it notices that there are no more mails to send!)