Mattermost won't send email with Postfix

Summary
I have setup an postfix with TLS and DKIM enabled and it can be send email with sendmail command, however I can’t send email through TestConnection button or ResetPassword form.

Steps to reproduce

  1. setup a mattermost with docker hub team-edition:release-7.2
  2. setup postfix with docker and works on sendmail command.
  3. Configure the mattermost to use the postfix and press the test conenction button

Expected behavior
Expected send email to System admin email

Observed behavior
It shows not errors on mattermost test connection button, however I see the following error on postfix.

relay=aspmx.l.google.com[108.177.125.27]:25, delay=0.88, delays=0.05/0/0.41/0.42, dsn=5.7.1, status=bounced (host aspmx.l.google.com[108.177.125.27] said: 550-5.7.1 [153.120.38.130] Messages missing a valid messageId header are not 550 5.7.1 accepted. g4-20020a655944000000b0042b260400dcsi1070399pgu.507 - gsmtp (in reply to end of DATA command))

Hi luvwinnie,

Please add the following configuration option to your /etc/postfix/main.cf:

always_add_missing_headers = yes

Usually, the MUA is responsible for adding all relevant headers which seems to not be the case here and recently, Google introduced a stronger Antispam policy on their edge servers and is now refusing mails with missing headers, but Postfix can automatically add them with this option.

Thank you so much! I’m able to send email!