Skip to content

Instantly share code, notes, and snippets.

@iberno
Created November 24, 2016 03:50
Show Gist options
  • Save iberno/d96beea154a60e8289bd59db43b8fad6 to your computer and use it in GitHub Desktop.
Save iberno/d96beea154a60e8289bd59db43b8fad6 to your computer and use it in GitHub Desktop.
SMTP Gmail Postfix
Siga os seguintes Passos <Follow this steps>
1 - No terminal copie e cole o comando abaixo para criar o arquivo
1 - < On terminal copy and paste this command line to create a file >
sudo vim /etc/postfix/sasl_passwd
2 - Insira as infomações de smtp e porta e senha
2 - < Insert your smtp account informations >
/etc/postfix/sasl_passwd
[smtp.gmail.com]:587 [email protected]:PASSWORD
3 - Mapeie o arquivo utilizando comando abaixo, isso vai gerar um arquivo de db com o mesmo nome
3 - < Using the command down, this will map the file and generate another with same name .db >
sudo postmap /etc/postfix/sasl_passwd
4 - No arquivo a seguir (pode ser aberto com editor de texto tipo sublime) procure a linha e faça as devidas alterações com seus dados.
4 - < The next file (can be open using finder and sublime text) follow the lines and change with your informations account >
sudo vim /etc/postfix/main.cf
inet_protocols = ipv4
# Gmail SMTP relay
relayhost = [smtp.gmail.com]:587
# Enable SASL authentication in the Postfix SMTP client.
smtpd_sasl_auth_enable = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtp_sasl_mechanism_filter = AUTH LOGIN
# Enable Transport Layer Security (TLS), i.e. SSL.
smtp_use_tls = yes
smtp_tls_security_level = encrypt
tls_random_source = dev:/dev/urandom
sudo postfix stop && sudo postfix start
date | mail -s "Teste de Email" [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment