ssmtp + google email + aws ses

Created: Jan. 1, 2010, 4 a.m.
Update: Sept. 26, 2021, 10:04 a.m.
Como enviar email usando SMTP

Usando uma conta de email para enviar emails
Google Mail - Gmail
Amazon AWS SES

Instalar pacotes

$ apt-get install ssmtp mailutils

Editar arquivo de configuração

$ vim /etc/ssmtp/ssmtp.conf

# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=from@mydomain.com

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
# mailhub=mail
# Where will the mail seem to come from?
rewriteDomain=mydomain.com

# The full hostname
hostname=backup-server

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES

mailhub=smtp.googlemail.com:587

AuthUser=user@futuria.com.br

AuthPass=password

FromLineOverride=YES

UseTLS=YES

UseSTARTTLS=YES

Teste SSMTP

$ ssmtp -v user@domain.com < /dev/null

Tiago de Souza Moraes - teago.futuria.com.br - 2021 // CSS by UIKIT CSS