Here is how I send emails from the command line in Ubuntu servers in the cloud via G SUote connect emails
Jan 2018 Update
Post on adding a second domain to G Suite
Post on adding email aliases to G Suite
Main
If you use ufw for your Ubuntu firewall then allow port 587 out traffic (read more in securing Ubuntu in the cloud here).
Ensure your port is open on IPV4 and IPV6.
If you have a GUI managed firewall with your server host then configure it to allow port 587 (out).
Read more on useful terminal commands here or setting up a Digital Ocean Ubuntu server here for as low as $5 a month here, Vultr server for as low as $2.5 here ($10 free credit). Read more about setting up an AWS Ubuntu server here.
Install sendmail and other pre requisites
Now you are ready to send an email with 1 line in the terminal (use your Gmail email unless you have diverted your email to G Suite (then use that email, guide here). Create a G Suite account here.
FYI: I have setup my email for my domain to redirect via G Suite (see my guide here and older guide here)
Send an email from the command line
This is not a drop-in replacement for Outlook or Thunderbird email clients but it is perfect for command-line alerts to con-jobs or start-up notifications.
Sending an email with an attachment
Coming soon: A guide on backing up Ubuntu with Rsync etc.
More
Post on adding a second domain to G Suite
Post on adding email aliases to G Suite
Donate and make this blog better
Ask a question or recommend an article
[contact-form-7 id=”30″ title=”Ask a Question”]
v1.2 added other links
v1.1 added links to two G Suite guides.