Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thread 'main' panicked at 'called Result::unwrap() on an Err value: MissingStartTls #10

Closed
awol2005ex opened this issue Jan 29, 2023 · 7 comments

Comments

@awol2005ex
Copy link

awol2005ex commented Jan 29, 2023

version: mail-send = "0.3.0"

when not connect to stmp with tls:
match SmtpClientBuilder::new(email_host,25) .implicit_tls(false) .credentials((email_username, email_password)) .timeout(Duration::from_secs(3)) .connect() .await .unwrap() .send(message) .await { Ok(_) => println!("Email sent successfully!"), Err(e) => panic!("Could not send email: {:?}", e), }

thread 'main' panicked at 'called Result::unwrap() on an Err value: MissingStartTls',

@epompeii
Copy link

I am also having issues with the new version and implicit_tls() with the following error Failed to create TLS connection for email: TLS error: received corrupt message.

I am trying to connect to AWS SES on port 587.

@mdecimus
Copy link
Member

thread 'main' panicked at 'called Result::unwrap() on an Err value: MissingStartTls',

@awol2005ex This error is because the server does not seem to support the STARTTLS command and you are using the TLS client builder. If you connect manually using telnet and write

EHLO mydomain.org

do you see STARTTLS listed as a capability? If you don't then you need to use the plain text client builder.

@mdecimus
Copy link
Member

I am also having issues with the new version and implicit_tls() with the following error Failed to create TLS connection for email: TLS error: received corrupt message.

I am trying to connect to AWS SES on port 587.

Are you setting implicit tls to false?

@awol2005ex
Copy link
Author

I change the code to
match SmtpClientBuilder::new(email_host,25) .implicit_tls(false) .credentials((email_username, email_password)) .timeout(Duration::from_secs(3)) .connect_plain() .await .unwrap() .send(message) .await { Ok(_) => println!("Email sent successfully!"), Err(e) => panic!("Could not send email: {:?}", e), }

But error :
thread 'main' panicked at 'called Result::unwrap() on an Err value: UnexpectedReply(Response { code: 220, esc: [0, 0, 0], message: " Microsoft ESMTP MAIL Service ready at Wed, 1 Feb 2023 09:22:55 +0800" })', src/main.rs:354:38

The stmp server connect return code is 220 not 200 so go to Err . but 220 is corrent code

@mdecimus
Copy link
Member

mdecimus commented Feb 1, 2023

thread 'main' panicked at 'called Result::unwrap() on an Err value: UnexpectedReply(Response { code: 220, esc: [0, 0, 0], message: " Microsoft ESMTP MAIL Service ready at Wed, 1 Feb 2023 09:22:55 +0800" })', src/main.rs:354:38

There was a bug in the plain text connect which has now been fixed on version 0.3.1.

@awol2005ex
Copy link
Author

It's OK after upgrade to version 0.3.1

@awol2005ex
Copy link
Author

It's OK after upgrade to version 0.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants