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

Send mail with gmail smtp server, got error Error { kind: Response, source: "incomplete response" } #866

Open
ipconfiger opened this issue Apr 1, 2023 · 4 comments

Comments

@ipconfiger
Copy link

Describe the bug
Send mail with gmail smtp server, got error Error { kind: Response, source: "incomplete response" }

To Reproduce
Code allowing to reproduce the bug.

    let from = "********@gmail.com".parse().unwrap();
    // 设置收件人邮箱地址
    let to = "*****@xxx.com".parse().unwrap();
    // 创建邮件
    let email = Message::builder()
        .from(from)
        .to(to)
        .subject(title)
        .header(ContentType::TEXT_PLAIN)
        .body(content)
        .unwrap();

    let smtp_server = "smtp.gmail.com";
    let smtp_port = 587;
    let username = "*****@gmail.com";
    let password = "*******";
    
    let smtp_transport = SmtpTransport::starttls_relay(smtp_server)
        .unwrap()
        .credentials(Credentials::new(username.to_string(), password.to_string()))
        .port(smtp_port).build();

    let result = smtp_transport.send(&email);
    match result {
        Ok(_) => println!("Email sent successfully!"),
        Err(e) => panic!("Could not send email: {e:?}"),
    }

Expected behavior
send mail success

Environment (please complete the following information):

  • Lettre version "0.10.0"
  • OS MacOS 13.2.1
@n00bsteam
Copy link

Same issue with yandex smtp :(

@c-git
Copy link

c-git commented Apr 12, 2023

For Gmail you would need to turn on MFA and then create an app password, it didn't work with a normal password for me. If you have any issues let me know.

@n00bsteam
Copy link

n00bsteam commented Apr 13, 2023

For Gmail you would need to turn on MFA and then create an app password, it didn't work with a normal password for me. If you have any issues let me know.

For me, all works fine with Gmail and application password, but have a problem with yandex, and yes, I'm using application password.

Come here from this thread - https://vaultwarden.discourse.group/t/smtp-error-response-error-incomplete-response/2466

@c-git
Copy link

c-git commented Apr 13, 2023

Never used yandex so IDK but I've tried Gmail and can confirm application password works for me as well

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

No branches or pull requests

3 participants