piknik
piknik copied to clipboard
Send mail with gmail smtp server, got error Error { kind: Response, source: "incomplete response" }
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
Same issue with yandex smtp :(
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 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
Never used yandex so IDK but I've tried Gmail and can confirm application password works for me as well