$ 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.
Obviously you need to make sure the usual stuff is possible: firewall allows to connect using smtp to gmail, login/password are correct, etc. One additional layer of security is to create an 'app' password for your gmail account (https://support.google.com/accounts/answer/185833?hl=en) . Your can then be sure that only this app will be using this app password, so if compromised just revoke the app password.
just for fun I tried and it works:
Obviously you need to make sure the usual stuff is possible: firewall allows to connect using smtp to gmail, login/password are correct, etc. One additional layer of security is to create an 'app' password for your gmail account (https://support.google.com/accounts/answer/185833?hl=en) . Your can then be sure that only this app will be using this app password, so if compromised just revoke the app password.
You have to change security settings of your accoutn.
By running
You recieve a mail like
with a link to a page with a button allowing to use the app: