Trouble with the lettre crate

Hello rustaceans, recently I was working on a project using the lettre crate ( After my code would take user input and process it, my function sendmail() would send the results to a certain email. The program seems to run correctly, however the email never arrives at the specified inbox. would someone please help me with the code?

extern crate lettre;

extern crate env_logger;

use lettre::{EmailAddress, Envelope, SendableEmail, Transport};

use lettre::SendmailTransport;
fn main() {

    sendmail("test message".to_string());

fn sendmail(message: String) {
    let envelope = Envelope::new(

    let email = SendableEmail::new(

    let mut sender = SendmailTransport::new();

Could you check your sendmail's logs? Maybe GMail is blocking you as spam, for example.

here are the sendmail logs. (using sendmail on mac)

-Queue ID-  --Size-- ----Arrival Time---- -Sender/Recipient-------
344C815EAB68      305 Fri Dec 13 20:38:21
   (connect to[]:25: Operation timed out)

30E6A15EAAA6      305 Fri Dec 13 20:37:03
      (connect to[]:25: Operation timed out)

Apperently the operations are timing out.

Any suggestions?

Ask a real smtp server to send the email for you. Sending email correctly is nigh-impossible and requires all sorts of crazy setup at both the server and dns level.

AFAIK that's exactly what SendmailTransport does - it simply calls the system sendmail. Or do you mean "use some external server, not your own"?

If you can set up your local sendmail correctly, go ahead, but doing that is very difficult, so I recommend using an external one you know works.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.