2

I have a Ubuntu 16.10 VM that I'm trying to configure to send mail from the shell with my gmail address via crontab.

Which /etc file do I need to amend and what options do I need to set?

1 Answer 1

2

You may want to switch to postfix and then you can "relay" your email via your gmail SMTP. (make sure you setup the less-secure apps setting(s) inside of google as well so it will allow the SMTP connection from your machine)

apt-get update && apt-get install postfix mailutils

vi /etc/postfix/sasl_passwd

add this line:

[smtp.gmail.com]:587 [email protected]:password

chmod 600 /etc/postfix/sasl_passwd

vi /etc/postfix/main.cf

relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

then encode your password

postmap /etc/postfix/sasl_passwd

then kick postfix

systemctl restart postfix.service

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .