I want to use SendGrid as my email sending service, but want to also use Postfix's internal queue mechanism to manage the emails sent through Sendgrid.

So basically what I want to do is to configure Postfix to send emails through Sendgrid's SMTP, and I will configure my app to send the emails using the local Postfix.

My question is, how can I configure Postfix to use an external SMTP? Looked here but didn't see anything useful.


This is detailed in http://www.postfix.org/BASIC_CONFIGURATION_README.html#relayhost

| improve this answer | |

Looks like you got things figured out, but for future reference to anyone who's looking:

1) Edit your Postfix configuration file

Open up your /etc/postfix/main.cf config file and edit it to have the following values:

smtp_sasl_auth_enable = yes 
smtp_sasl_password_maps = static:yourSendgridUsername:yourSendgridPassword 
smtp_sasl_security_options = noanonymous 
smtp_tls_security_level = may
start_tls = yes
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587

2) Restart your postfix server

Run the following command in your terminal

/etc/init.d/postfix restart

3) Start sending

You're all set, go ahead and start sending with your SendGrid account!

If you run into any issues, you can always ask our 24/7 support team or tweet at @SendGrid.

| improve this answer | |
  • Exactly what I did. Very straight-forward :) Thanks! – Eduard Luca Sep 11 '12 at 7:48
  • If submission to your service is always encrypted, you should use smtp_tls_security_level=encrypt. start_tls is not a postfix configuration setting; remove it. – adaptr Sep 11 '12 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.