sudo vim /etc/postfix/sasl_passwd
smtp.gmail.com:587 [email protected]:password
sudo postmap /etc/postfix/sasl_passwd
sudo vim /etc/postfix/main.cf
relayhost = smtp.gmail.com:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_use_tls = yes
smtp_tls_security_level = encrypt
tls_random_source = dev:/dev/urandom
smtp_sasl_security_options = noanonymous
smtp_always_send_ehlo = yes
smtp_sasl_mechanism_filter = plain
Check postfix status:
sudo postfix status
-
If postfix is not running, start the service:
postfix/postfix-script: the Postfix mail system is not running
sudo postfix start
postfix/postfix-script: starting the Postfix mail system
-
If postfix is running, reload the service:
postfix/postfix-script: the Postfix mail system is running: PID: XXXX
sudo postfix reload
postfix/postfix-script: refreshing the Postfix mail system
date | mail -s testing [email protected]
mailq
- To clear the mail queue:
sudo postsuper -d ALL
- If you receive a message like
(TLS is required, but our TLS engine is unavailable)
enable tls:sudo postfix tls enable-client
In Gmail we must switch on the option “Access for less secure apps“, otherwise we will get the error: SASL authentication failed https://support.google.com/mail/answer/7126229?p=BadCredentials&rd=2#cantsignin
Hi bro~~
thanks the nice tutorial, however it doesn't work on my high Sierra 10.13.
I have no idea to figure the problem. so could you check my log blow and give some advices?
+++++++++++++
PKCU:~ avis$ postconf -n
biff = no
command_directory = /usr/sbin
compatibility_level = 2
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = /usr/share/doc/postfix/html
inet_protocols = all
mail_owner = _postfix
mailbox_size_limit = 0
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
message_size_limit = 10485760
mynetworks = 127.0.0.0/8, [::1]/128
newaliases_path = /usr/bin/newaliases
queue_directory = /private/var/spool/postfix
readme_directory = /usr/share/doc/postfix
recipient_delimiter = +
relayhost = smtp.gmail.com:587
sample_directory = /usr/share/doc/postfix/examples
sendmail_path = /usr/sbin/sendmail
setgid_group = _postdrop
smtp_always_send_ehlo = yes
smtp_sasl_auth_enable = yes
smtp_sasl_mechanism_filter = plain
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
smtp_use_tls = yes
smtpd_client_restrictions = permit_mynetworks permit_sasl_authenticated permit
smtpd_tls_ciphers = medium
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 550
PKCU:~ avis$ sudo postfix reload
Password:
postfix/postfix-script: fatal: the Postfix mail system is not running
PKCU:~ avis$