Sending email through Gmail server using mailx command

Posted on 14-04-2017 by Nadir Latif


Mailx command can be used to send email through the gmail smtp server. For example the following command can be used:

mailx -s "Memory usage on server is more than 70%. Please check!." -r "reply_email" -S smtp="" -S    \
smtp-use-starttls -S smtp-auth=login -S smtp-auth-user="gmail_address" -S smtp-auth-password="gmail_password" -S \
ssl-verify=ignore recepiant_email < /tmp/mail_body.txt

In the above command the "gmail_address" needs to allow access from insecure devices. This article

explains how to do this