3

I have Postfix 2.6.6 installed on my CentOS server. I use SendGrid for all outgoing mail, and have the following settings in my Postfix main.cf file...

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:Username:Password
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
header_size_limit = 4096000
relayhost = smtp.sendgrid.net:587
smtp_tls_CAfile = /home/artmgr/certs/gd_bundle-g2-g1.crt 

This server runs a few PHP sites that generate automated emails. Usually all email generated on the server is relayed to SendGrid. However, when sending to an email address that uses the same domain as the hostname of my server, the email lands in the root mailbox on the local server instead of being relayed to SendGrid.

For example, let's say the hostname of my server is mydomain.com. When an email is generated on the server to be sent to support@mydomain.com it lands in the root mailbox on the local server.

Is there any way to tell Postfix to send all email, even mail that uses the local hostname, via the SendGrid relay?

Monty
  • 304
  • 2
  • 14

1 Answers1

0

On a shell, run the following code,

postconf -e "mydestination="
postfix reload

This will clear the mydestination variable, thus no mail is considered local.

Ralf Hildebrandt
  • 543
  • 2
  • 16