I am trying to use s-nail with gmail smtp server to send mail from my aws vps. With outgoing firewall being opened to 587, I believe the error I am getting is due to my gmail account not recognizing the smtp host.

SMTP Host- Ubuntu Server 18.04 on AWS


echo -e "Email content" | s-nail -v -s "Email subject" -S smtp-use-starttls -S ssl-verify=ignore -S smtp-auth=login -S smtp=smtp://smtp.gmail.com:587 -S from="Me" -S smtp-auth-user=email@gmail.com -S smtp-auth-password=password -S ssl-verify=ignore -S nss-config-dir=~/.certs email@gmail.com


s-nail: Loading /etc/s-nail.rc
s-nail: No such file to load: /home/energi/.mailrc
s-nail: Setting up PseudoRandomNumberGenerator: *SSL RAND_*
s-nail: Obsoletion warning: Use of old-style credentials, which will vanish in v15!
  Please read the manual section "On URL syntax and credential lookup"
s-nail: Obsoletion warning: please don't use *smtp*: assign a smtp:// URL to *mta*!
s-nail: Resolving host smtp.gmail.com:587 ... done
s-nail: Connecting to ... connected.
s-nail: smtp-server: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbsxgg9BB4ZxqT48Qwxgc8cTPMp0x_U0gxxHM2tGek8csEZ2sizt0IElRkg_...._.....etcetc
smtp-server: 534-5.7.14 Please log in via your web browser and then try again.
smtp-server: 534-5.7.14  Learn more at
smtp-server: 534 5.7.14  https://support.google.com/mail/answer/78754 b73sm2170494ywe.28 - gsmtp

Here is what I have done,

-Copied link (in above error) via putty client on Windows to Firefox, then verified it was me. However, I believe I have to be on the host, which I am using Ubuntu Server 18.04 with no GUI. Ubuntu Host is on AWS VPS and Windows Host is on my local laptop.

-I have allowed less secured apps. I don't want to but I did enable. Can I re enable?

Current Result: everytime command executed, I get the error, even when I verified. No email sent.

Expected Result: execute command from Ubuntu Server host and recieve test email.

  • 1
    You need to set an app-specific password in your GMail and use that. Assuming that is what you've done then you've misconfigured s-nail. – Thomas Ward Feb 11 at 18:11
  • No I have not done that. support.google.com/accounts/answer/185833?hl=en . I will – user235818 Feb 11 at 18:17
  • SMTP and SASL auth is needed for s-nail and others to deliver with SMTP to GMail SMTP. Which necessitates the creation of an app password for your Google login. SMTP doesn't come with the "Sign in with Google" solution, so you're going to have to use the old school password route. – Thomas Ward Feb 11 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.