First, install the Heirloom mailx client with yum install mailx. The NSS certificates included with the AMI are either out of date or incomplete, so you've got to grab the Equifax root cert and set it up yourself, like this:
wget https://www.geotrust.com/resources/root_certificates/certificates/Equifax_Secure_Certificate_Authority.cer certutil -d ~/.mailcerts/ -A -t TC -n "Equifax Secure Certificate Authority" -i Equifax_Secure_Certificate_Authority.cerThen set up your ~/.mailrc like this:
set smtp-use-starttls set smtp=smtp://smtp.gmail.com:587 set smtp-auth=login set smtp-auth-user="firstname.lastname@example.org" set smtp-auth-password="your_password" set from="email@example.com" set nss-config-dir="~/.mailcerts" set ssl-verify=warnThat last "ssl-verify=warn" line looks pretty dangerous, and it definitely could be. I needed it because otherwise mailx would bark with Comparing DNS name: "smtp.gmail.com" Continue (y/n)? and...giving up, instead of accepting any input. For whatever reason my Debian box works fine without this line. Also, one could use this line without setting up the root certificate appropriately, but that's playing a bit too fast and loose for me.
With this configuration you should be good to go with: echo "body here" | mailx -s "Subject here" firstname.lastname@example.org