Caution: This documentation refers to a deprecated version of the Mailjet API. It is not compatible with your account.
Please check the API v3 documentation for an updated version of this content.
Postfix Installation
Here is the the Postfix configuration to send via in.mailjet.com relay, depending on the sender.
In this example, all outgoing emails are sent directly to Mail eXchangers (MX), except when from is *@example.com or example@example.net which are going through Mailjet.
Caution, for Postfix, a sender is not the From: but the sender envelope passed to sendmail (in the 5th mail()
argument: -fexample@example.com
or in PHP config php.ini
: sendmail_path = /path/to/sendmail -t -i -fexample@example.com
).
In /etc/postfix/main.cf
(remove relayhost):
smtp_sender_dependent_authentication = yes sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay smtp_sasl_auth_enable = yes smtp_sasl_security_options = noanonymous smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
In /etc/postfix/sender_relay
, list addresses that must go through a relay:
@example.com in.mailjet.com example@example.net in.mailjet.com
In /etc/postfix/sasl_passwd
, provide credentials for each address listed in /etc/postfix/sender_relay
:
@example.com apikey:secretkey example@example.net apikey2:secretkey2
Don't forget the following commands:
cd /etc/postfix
chmod 600 sasl_passwd
chown root:root sasl_passwd
postmap sasl_passwd sender_relay
postfix reload