Setting up postfix to relay through your gmail account
So this is kind of an odd topic. Why would you want to setup postfix to relay through your gmail. Well if you are using Verizon as an ISP for your home internet, you will find that they do not allow you send email from a locally running SMTP server, like postfix on your linux box or mac. They just block it. It is probably to prevent spammers however, if you need to write some email code, you will have to setup a relay through an SMTP server that you have access to, like gmail.
Here are the steps involved:
1. Create a Simple Authentication and Security Layer (SASL) password file at /etc/postfix/sasl_passwd. Enter in your gmail account info as it is shown below:smtp.gmail.com:587 enter_account@gmail.com:enter_password
2. Create a Postfix lookup table for your password filesudo postmap /etc/postfix/sasl_passwd
3. Add the following to your /etc/postfix/main.cf. Depending on your installation, these configurations may be commented out so all you need to do is uncomment them and enter in the appropriate values # Minimum Postfix-specific configurations.
mydomain_fallback = localhost
mail_owner = _postfix
setgid_group = _postdrop
relayhost=smtp.gmail.com:587
# Enable SASL authentication in the Postfix SMTP client.
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options=
# Enable Transport Layer Security (TLS), i.e. SSL.
smtp_use_tls=yes
smtp_tls_security_level=encrypt
tls_random_source=dev:/dev/urandom
4. Start postfixsudo postfix start
You can test out your configuration by sending yourself a quick email from the command line.echo "Hello World" | mail -s Hello enter_your_address@here.com
If you do not get the email, you can check to see if has actually sent using the following commandmailq
To clear your mail queue, use this commandsudo postsuper -d ALL
-
theresa990k liked this
-
verycrispy posted this