0

The Configs

We did the usual main.cf (postfix) relay/sasl entries:

# Amavisd + SpamAssassin + ClamAV
#
content_filter = smtp-amavis:[127.0.0.1]:10024

# Concurrency per recipient limit.
smtp-amavis_destination_recipient_limit = 1

relayhost = [smtp.mailgun.org]:587

smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:login@domain.com:password
smtp_sasl_security_options = noanonymous

This actually works perfectly fine, and mail deliveries are properly logged under Mailgun too.

The Problem
If we send an email within our domain, it's not triggering Mailgun. Means: if JohnDoe@ourXYZDomain.com sends an email to JaneDoe@ourXYZDomain, it is delivered via postfix. If JohnDoe@ourXYZDomain.com sends an email to JohnDoe@someOtherDomain.com, it is delivered and logged via Mailgun smtp.

The Analysis
Mails within same domain are sent and no errors are thrown. When looking into header of received email, it shows that postfix didn't even bother using Mailgun. See localhost [127.0.0.1] in line 6:

Subject:test - 00:11
Contact photo
From    johndoe@ourXYZDomain.com    Date    Mon 00:11
Return-Path: <johndoe@ourXYZDomain.com>
Delivered-To: janedoe@ourXYZDomain.com
Received: from mail.ourXYZDomain.com (localhost [127.0.0.1])
    by mail.ourXYZDomain.com (Postfix) with ESMTP id 49KwDw97hggXdtN
    for <janedoe@ourXYZDomain.com>; Sun, 10 May 2020 20:11:12 +0000 (UTC)
Authentication-Results: mail.ourXYZDomain.com (amavisd-new); dkim=pass
    reason="pass (just generated, assumed good)"
    header.d=ourXYZDomain.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=
    ourXYZDomain.com; h=user-agent:message-id:subject:subject
    :to:from:from:date:date:content-transfer-encoding:content-type
    :content-type:mime-version; s=dkim; t=1589141471; x=1591733472;
    bh=WonWKNs0MVBQ4Md9bT3TQ0-----=; b=1lp9qX-----YE
    HQwrRVwjLjcPcP/jkjhgjghgfWisfODNZ5xHnQto5Xa
    D6/Wj8fAEpwiu8uG5Ujhugz778gjNZ8UhFXtJf2aK
    1B8iZembDuiIsjg6fKj6snRjA=
X-Virus-Scanned: amavisd-new at mail.ourXYZDomain.com
Received: from mail.ourXYZDomain.com ([127.0.0.1])
    by mail.ourXYZDomain.com (mail.ourXYZDomain.com [127.0.0.1]) (amavisd-new, port 10026)
    with ESMTP id xzds0121548c for <janedoe@ourXYZDomain.com>;
    Sun, 10 May 2020 20:11:11 +0000 (UTC)
Received: from _ (localhost [127.0.0.1])
    by mail.ourXYZDomain.com (Postfix) with ESMTPSA id 49KwDv54101252XdtL
    for <janedoe@ourXYZDomain.com>; Sun, 10 May 2020 20:11:11 +0000 (UTC)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII;
    format=flowed
Content-Transfer-Encoding: 7bit
Date: Mon, 11 May 2020 00:11:11 +0400
From: johndoe@ourXYZDomain.com
To: janedoe@ourXYZDomain.com
Subject: test - 00:11
Message-ID: <1003f6125a2ff654101214@ourXYZDomain.com>
X-Sender: johndoe@ourXYZDomain.com

We have no explanation for this behaviour. Maybe we missed something?

Thank you for any hint

0

When You send mail from one mydomain virtual mailbox to another mydomain virtual mailbox postfix will not relay it to Mailgun and transport it locally.

You need to create multiple instances of Postfix where one instance will relay all mails to Mailgun without local delivery and the second instance will listen 25 port for income mail and will deliver it to virtual boxes.

Explanation of this solution You can find there: http://www.postfix.org/MULTI_INSTANCE_README.html

1
  • works perfectly fine. thank you – DingDong May 27 '20 at 10:01

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.