Skip to content

How to forward attachments in a message #753

Discussion options

You must be logged in to vote

Assuming your starting point is something like

  let m = Message::builder()
      .from("NoBody <nobody@domain.tld>".parse()?)
      .to("Hei <hei@domain.tld>".parse()?)
      .subject("Something")
      // Rest of the headers...
      // and then:
      .multipart(MultiPart::alternative_plain_html(
          String::from("Plaintext version of the body"),
          String::from("Html version of the body"),
      ));

what you can do is change it to:

 let mut multipart = MultiPart::alternative_plain_html(
      String::from("Plaintext version of the body"),
      String::from("Html version of the body"),
  );

  for file in files_to_attach {
      let attachment = Attachment::new(file_name).b…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by runqi-zhao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #752 on April 06, 2022 07:00.