我可以用swaks通过Gmail发送邮件吗?

我已经尝试了多种方法来validationgmail发送电子邮件swaks没有成功。

有没有办法用swaks通过Gmail发送电子邮件

只是为了好玩我试过了,它的工作原理:

 $ swaks -t [email protected] -s smtp.gmail.com:587 -tls -a LOGIN [enter] Username: my.gmail.login Password: my.password [password will be visible here, no asteriks] === Trying smtp.gmail.com:587... === Connected to smtp.gmail.com. <- 220 smtp.gmail.com ESMTP a45sm2396859eda.3 - gsmtp -> EHLO e7250 <- 250-smtp.gmail.com at your service, [77.249.1.91] <- 250-SIZE 35882577 <- 250-8BITMIME <- 250-STARTTLS <- 250-ENHANCEDSTATUSCODES <- 250-PIPELINING <- 250-CHUNKING <- 250 SMTPUTF8 -> STARTTLS <- 220 2.0.0 Ready to start TLS === TLS started with cipher TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128 === TLS no local certificate set === TLS peer DN="/C=US/ST=California/L=Mountain View/O=Google Inc/CN=smtp.gmail.com" ~> EHLO e7250 <~ 250-smtp.gmail.com at your service, [77.249.1.91] <~ 250-SIZE 35882577 <~ 250-8BITMIME <~ 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH <~ 250-ENHANCEDSTATUSCODES <~ 250-PIPELINING <~ 250-CHUNKING <~ 250 SMTPUTF8 ~> AUTH LOGIN <~ 334 xxxxxxxxxxx ~> xxxxxxxxxxxxxxx <~ 334 xxxxxxxxxxxxxxx ~> xxxxxxxxxxxxxxxxxxxxxxxxxxxx== <~ 235 2.7.0 Accepted ~> MAIL FROM:<user@host> <~ 250 2.1.0 OK a45sm2396859eda.3 - gsmtp ~> RCPT TO:<[email protected]> <~ 250 2.1.5 OK a45sm2396859eda.3 - gsmtp ~> DATA <~ 354 Go ahead a45sm2396859eda.3 - gsmtp ~> Date: Sun, 23 Apr 2017 10:35:17 +0200 ~> To: [email protected] ~> From: user@host ~> Subject: test Sun, 23 Apr 2017 10:35:17 +0200 ~> X-Mailer: swaks v20130209.0 jetmore.org/john/code/swaks/ ~> ~> This is a test mailing ~> ~> . <~ 250 2.0.0 OK 1492936526 a45sm2396859eda.3 - gsmtp ~> QUIT <~ 221 2.0.0 closing connection a45sm2396859eda.3 - gsmtp === Connection closed with remote host. 

显然你需要确保通常的东西是可能的:防火墙允许连接使用SMTP到Gmail,login/密码是正确的等等。一个额外的安全层是为您的Gmail帐户创build一个“应用程序”密码( https:/ / /support.google.com/accounts/answer/185833?hl=zh-CN )。 然后,您可以确保只有这个应用程序将使用这个应用程序的密码,所以如果妥协只是撤销应用程序的密码。

您必须更改您的accoutn的安全设置。

通过运行

  swaks -tls -t -s smtp.gmail.com:587 -tls -a LOGIN [enter] 

你收到一封像

在这里输入图像说明

带有一个链接到一个页面的button,允许使用该应用程序:

在这里输入图像说明