1

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.

adamo
  • 6,925
  • 3
  • 30
  • 58
Eduard Luca
  • 371
  • 2
  • 9
  • 19

2 Answers2

2

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

adaptr
  • 16,576
  • 23
  • 34
  • Thanks. I got about the same thing at http://docs.sendgrid.com/documentation/get-started/integrate/examples/postfix/ and I just needed to copy paste it and it worked. It's basically the same thing you said, so I'm going to accept your answer in about 5 minutes :) – Eduard Luca Sep 10 '12 at 12:54
2

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.

Swift
  • 205
  • 2
  • 8
  • Exactly what I did. Very straight-forward :) Thanks! – Eduard Luca Sep 11 '12 at 07: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