[SOLVED] Email with attachment


Hello, everybody. I have to find a way to send emails with the PDF file attached. Do you know some package for that? I have found this one, but it is deprecated, is not in the crates anymore and does not seem to have any docs. Does anyone know the better package?


Have you tried Mailstrom (the successor):

Or lettre together with MimeMessage:



I’ve only used lettre so far (worked really well), so I can’t comment on the other crates.

Note that you can use crates that are not on crates.io but on github - see cargo guide:


rand = { git = "https://github.com/rust-lang-nursery/rand.git", rev = "9f35b8e" }

(example from the cargo guide)


Thanks for the links!

I have looked at Mailstrom - it does not seem to support attachment.

As for the Lettre - I have found somewhere in it’s docs that it does not support attachments yet. So you advice to use MimeMessage to add this support, but I am not sure I can do it w/o any example :slight_smile: I am very new to Rust, started learning it just a few days ago and decided to learn by implementing the real task with it. Already getting the data fom the db, sending push notifications to the mobile apps, generating PDFs with qr codes, but stuck with sending email :slight_smile:

Have you used Lettre to send multi-part messages or just the text part?


I’ve used lettre to just send text only, sorry!


Finished with just generating the command lines for “mail” and sending through Postfix. Works like a charm.