I have a simple goal: I am setting up a monitoring system and I want this monitoring system to send me emails when a problem with my servers occurs.
I have Postfix installed. And I want to use mail
, bsd-mailx
or sendmail
(by Postfix) to send an email to ivan@gmail.com
(for example).
I have an account at SendinBlue and I have configured my Postfix to use as a relayhost
the SendinBlue SMTP server:
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = ec2-99-99-99-99.eu-central-1.compute.amazonaws.com
mydomain = ec2-99-99-99-99.eu-central-1.compute.amazonaws.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = ec2-99-99-99-99.eu-central-1.compute.amazonaws.com
mydestination = project-monitor-de-frankfurt, localhost.localdomain, localhost, ec2-99-99-99-99.eu-central-1.compute.amazonaws.com
relayhost = smtp-relay.sendinblue.com:587
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
inet_interfaces = loopback-only
default_transport = error
relay_transport = error
inet_protocols = all
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
smtp_sasl_mechanism_filter = plain, login
In /var/log/mail.log
I always get status=bounced (smtp-relay.sendinblue.com:587)
when I am trying to send mail through sendmail ivan@gmail.com
. My sasl_passwd
file is configured and postmap
-ed.
I do not see a message like Authentication Required
and in my SendinBlue account I see no statistics (0 bounced messages), which means that my mails do not go out of my Postfix MTA?
Is the domain can be a problem?
Why is this happening and how can I use SendinBlue or Mandrillapp (for example) to use them as a relay and send emails to ivan@gmail.com
?
Best Answer
Maybe it's too little too late, but it might help someone else.
I had the same problem on Ubuntu 18.04 and it was resolved by putting a relay host in square brackets, and the port outside. Completly weird and never encountered this on other distributions. Might be something specific about postfix shipped with Ubuntu.
For example: