0

I have installed Postfix on my Ubuntu server and configured DKIM. I have tested DKIM on https://www.appmaildev.com/en/dkim and the results were good. However, I am confused as to why DKIM is only detected when I send it directly through the server command line with the syntax echo "hello" | sendmail account@gmail.com, but DKIM is not detected when I send emails using Thunderbird. What am I missing here?

this is the raw message if i sent it via command line

Delivered-To: mygmailaccount@gmail.com
Received: by 2002:a5d:5752:0:0:0:0:0 with SMTP id q18csp1295823wrw;
        Mon, 20 Mar 2023 13:46:04 -0700 (PDT)
X-Google-Smtp-Source: AK7set/bUbRpfneKGgcTItgO4AOxnqkFjX35fE2HGkRE6FzGRYLWfwaE36zd2RHEfm+fJDn0nt0S
X-Received: by 2002:a05:6a20:4e14:b0:d9:a38d:3ec7 with SMTP id gk20-20020a056a204e1400b000d9a38d3ec7mr718525pzb.29.1679345163599;
        Mon, 20 Mar 2023 13:46:03 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1679345163; cv=none;
        d=google.com; s=arc-20160816;
        b=vrRaamMKFDCm1ZHWWeOoiB5jZndGbXIjgQORtEK1LyxTfmCyawGiqgnr2xh4gNkuKx
         zab7JSCsIE11li5mfAyQpBBjfsS5yUCPWIGkoR/fnCJSmhHjGfcRCGv89SW6uST/dy+8
         rKJXaWZrvSVWNTkWYXWjbxPHddicgitV5IY9PFPu88XeVwYGinwaqnr44n7QLxzOFGxF
         np/i+CXYzDY8F4b6fh+MT1SXim+U1b4RbElGF11Z55C50gThgJNxIPJhBpJ5XgvhC1hQ
         RUQMeUtbDHSuWQdKB0rWyoq1Er5llnejBgsG91uDptF+tmVWabS6Kh+58CJaMl1TbAfB
         uKkg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=from:date:message-id:content-transfer-encoding:content-disposition
         :to:subject:dkim-signature;
        bh=mL4tIt2aAQZ/VQxL/5LleUtpCmkWkBVJWzGzVCeRIdY=;
        b=BVOGLRnP93JS9zMzbUUeINuQhx6VDdRjpsqqzEJAM8Aoe9Dl17oTUDOEneq3UQFZad
         Yrnqgx2w16B+TW6O40KeoMWXvzo5GTBw7PXfoZTBIpf/EAX9dVAOFBKiZS/3jx/kcc6p
         e0e6HW+4TML6eYtHtPyCOkBs5E/Lf/m23ZfIJdG7g203owWVd8kUxCA0lALrw09XIdDM
         tj9amDEzEura6X5nxkDRXpXBxPNSm1RnlmK+qdtbgd2cEmGDnfdNv6a8RmoMXlX9I1iv
         lpovzdtwknICGaiuJua57WVXguB7hXKXqxhPCfWM/KJ/cb9UXVkCliuMBxqcsUeLyGxC
         QN/Q==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass (test mode) header.i=@coderproject.my.id header.s=dkim header.b="DK/rg7gw";
       spf=pass (google.com: domain of myaccount@coderproject.my.id designates 103.56.149.104 as permitted sender) smtp.mailfrom=myaccount@coderproject.my.id;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=coderproject.my.id
Return-Path: <myaccount@coderproject.my.id>
Received: from mail.coderproject.my.id (coderproject.my.id. [103.56.149.104])
        by mx.google.com with ESMTPS id q83-20020a632a56000000b0050f79f0651fsi4141289pgq.95.2023.03.20.13.46.01
        for <mygmailaccount@gmail.com>
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Mon, 20 Mar 2023 13:46:02 -0700 (PDT)
Received-SPF: pass (google.com: domain of myaccount@coderproject.my.id designates 103.56.149.104 as permitted sender) client-ip=103.56.149.104;
Authentication-Results: mx.google.com;
       dkim=pass (test mode) header.i=@coderproject.my.id header.s=dkim header.b="DK/rg7gw";
       spf=pass (google.com: domain of myaccount@coderproject.my.id designates 103.56.149.104 as permitted sender) smtp.mailfrom=myaccount@coderproject.my.id;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=coderproject.my.id
Received: by mail.coderproject.my.id (Postfix, from userid 1001) id 4D63463641; Mon, 20 Mar 2023 20:46:00 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=coderproject.my.id; s=dkim; t=1679345160; bh=mL4tIt2aAQZ/VQxL/5LleUtpCmkWkBVJWzGzVCeRIdY=; h=Subject:To:Date:From:From; b=DK/rg7gwoA7hK7DzV+MGeB/ynX4mk3Co0xebDlN2EHFfPdvBUZgwFSTnM1WfkiRgX
     M9vwfRVANdyI49YY0A486vFEWk2mlz0yEG1V5T1gc342kVTFL1vLc9fqAPcaxdZiFM
     xMK4u6S3ndutI0npjWNatXb/n7iTQAyUSKpv5u6xS0ke0/susz9pWH9nY3Drxgw0J7
     /eNvwImhDiZ4jipVVn64E8HWxidpciyqs0L8TIYruZw/+BMNBmS7CuYmWx5I4Hsrgi
     WM1S8cre2PpPZw6cROlm9d7/m4JTdaIwaeFWRzOYY1P/55SXn/KGkuuOPejGNSuCVk
     BVEueCL3WjMKQ==
Subject: test
To: mygmailaccount@gmail.com
Content-Type: image/jpeg
Content-Disposition: attachment; filename=COBA.jpg
Content-Transfer-Encoding: base64
Message-Id: <20230320204600.4D63463641@mail.coderproject.my.id>
Date: Mon, 20 Mar 2023 20:46:00 +0000 (UTC)
From: myaccount Bahar <myaccount@coderproject.my.id>

this is the raw message if i sent it via thunderbird email client

Delivered-To: mygmailaccount@gmail.com
Received: by 2002:a5d:5752:0:0:0:0:0 with SMTP id q18csp1298758wrw;
        Mon, 20 Mar 2023 13:55:18 -0700 (PDT)
X-Google-Smtp-Source: AK7set/UfowVDllzL2uowlbonNpHRMzp6EMN8Y5WBO6hJBiroFjwra299D3V2eRCmQf/b7l4Zjcf
X-Received: by 2002:a05:6a20:3cab:b0:d0:4361:9720 with SMTP id b43-20020a056a203cab00b000d043619720mr20388189pzj.61.1679345717871;
        Mon, 20 Mar 2023 13:55:17 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1679345717; cv=none;
        d=google.com; s=arc-20160816;
        b=JX6/6OPC6fD56ltK6XGOBgJ/OB84udXrEtJhOkMdgiOrFwoiqobmuYMbWUtSCiMOx/
         +RW1HF4lVUKiB7cJG0fU1ylAPA3YCqSpk0tNAW/3IYnL32Hj2yqoH7OObsXDMx5TmKPn
         50iZ1juwVed3JKHhp4YKmvllS2bchgB3azPFt1BD0P8JjhQtX17lm5+MQ2m+ZvLJeEHq
         LzdGJ4GTz6m5FUYJI35IZyhaz/m04rFO6ckOetWMWT/hw422oyKUuCUNds9X9h+23XQL
         o2pL4h4fbqBvDd96svZVnhUf7VcuqtXpLlEDyNOQNykzWTi1wFyBVH0zacFJNNtvKec9
         nLGA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=subject:from:to:content-language:user-agent:mime-version:date
         :message-id;
        bh=9vPTXYLcppc9ZNlITdAYg4NdYmDZFU7sckhTdeyKeJQ=;
        b=ZKAAsAquXfn8+IqDfqsC67UeCZA48gb0GOXm9JXqfuFmvOBLwgWzHwrbCsZGh6UtRQ
         wyfcwGHUZQ+SRMNMBOCx5NPFsUIABokIjH9Xl1kqB1SjxAx0NNjAxge+CfFzgz7MiTvv
         p2TMPh8ftxyj+KQeSdn33v3YQaN28APSoO4CK54nxJJDGDbb1aNU/CjSFNSA9taXjQXC
         J1pNZ1nuF+7tknR0UMAcP2Mfyb3jupChM+1+HlncmwKDCFDWPH5vxGObNh3NBG86bhKP
         Xn0dqxspaZ8XU3uckxDDv89Oh1/j69Ltzut6PElbiJAJTbfW4Ir/SOz8PSkDV483/D3V
         xjjQ==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain of myaccount@coderproject.my.id designates 103.56.149.104 as permitted sender) smtp.mailfrom=myaccount@coderproject.my.id;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=coderproject.my.id
Return-Path: <myaccount@coderproject.my.id>
Received: from mail.coderproject.my.id (coderproject.my.id. [103.56.149.104])
        by mx.google.com with ESMTPS id o23-20020a63fb17000000b00502ec9cc2adsi11482245pgh.662.2023.03.20.13.55.13
        for <mygmailaccount@gmail.com>
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Mon, 20 Mar 2023 13:55:17 -0700 (PDT)
Received-SPF: pass (google.com: domain of myaccount@coderproject.my.id designates 103.56.149.104 as permitted sender) client-ip=103.56.149.104;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of myaccount@coderproject.my.id designates 103.56.149.104 as permitted sender) smtp.mailfrom=myaccount@coderproject.my.id;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=coderproject.my.id
Received: from [192.168.1.101] (unknown [182.2.141.212]) by mail.coderproject.my.id (Postfix) with ESMTPSA id E453C63641 for <mygmailaccount@gmail.com>; Mon, 20 Mar 2023 20:55:08 +0000 (UTC)
Content-Type: multipart/alternative; boundary="------------6D70L2ROq60OF2n6AabTQzgl"
Message-ID: <aeb4f54c-89ea-a6aa-25d2-13bed81815ba@coderproject.my.id>
Date: Tue, 21 Mar 2023 03:55:02 +0700
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0
Content-Language: en-US
To: mygmailaccount@gmail.com
From: myaccount Bahar <myaccount@coderproject.my.id>
Subject: Test Pesan

--------------6D70L2ROq60OF2n6AabTQzgl
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Test Pesan

Test Pesan Attachment Gambar
--------------6D70L2ROq60OF2n6AabTQzgl
Content-Type: multipart/related; boundary="------------S6Ey91uKS7BRtwsdBF6peNf4"

--------------S6Ey91uKS7BRtwsdBF6peNf4
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Test Pesan</p>
    <img moz-do-not-send="false"
      src="cid:part1.g3cj6xzE.YjwD0uxI@coderproject.my.id" alt="Test
      Pesan Attachment Gambar" width="1024" height="768">
  </body>
</html>
--------------S6Ey91uKS7BRtwsdBF6peNf4
Content-Type: image/jpeg; name="04.jpg"
Content-Disposition: inline; filename="04.jpg"
Content-Id: <part1.g3cj6xzE.YjwD0uxI@coderproject.my.id>
Content-Transfer-Encoding: base64


--------------S6Ey91uKS7BRtwsdBF6peNf4--
--------------6D70L2ROq60OF2n6AabTQzgl--
12
  • 4
    This is not really a security question. It is more a question on how to setup DKIM and your mail clients properly so that it works in all your use cases. Unfortunately your current description is missing relevant details, specifically how Thunderbird is configured regarding sending mail in contrast to "sendmail ...". Mar 17 at 18:06
  • If you installed postfix on the server, then it's possible that you still have some other MTA running on the server, and /usr/sbin/sendmail is routing messages through that MTA. Try sending a message via the command line to your gmail address. Then, in gmail, take a look at the headers of the message. Are you seeing that it was sent via postfix, or some other MTA?
    – mti2935
    Mar 17 at 18:08
  • hi i am really sorry for my late response i still need to figure it out why when i send an email via command line it show dkim but when i send it using email client like thunderbird or email client windows 10 it not show dkim. When i take alook at the header i saw that it was sent via postfix. Mar 19 at 2:26
  • @SteffenUllrich how the correct way to configured Thunderbird so when i send email via Thunderbird it also give a dkim inside the mail that i send ? Mar 19 at 2:28
  • @SteffenUllrich when i used dkim checker like this website dmarcian.com/dkim-inspector the page show that we need to input our dkim selector, so the checker can check our dkim available or not, what i think about email client like Thunderbird or Email Client Windows 10 maybe just same, we also need to set our dkim selector inside email client that we used, is it correct ? Mar 19 at 2:33

1 Answer 1

1

I had similar problems by using Thunderbird with my mail server. The situation was as follows:

  • Own mail server configured with ISPconfig and multiple domains.
  • I used one main mail address, but defined some alias addresses in Thunderbird, so I could use different sender addresses.
  • For outgoing mail I defined only the username (mail address) of the main account, so the SMTP login was handled with the same data for every mail address.

In my case, this was exactly what caused problems.

I had to change the outgoing SMTP server for every identity used in Thunderbird, so the SMTP login matched with the sender address.

A quick example:

  • FQDN of mail server: mail.example.org
  • each domain has its own MX records in DNS, so mx.example.com and mx.example.net have the same IP address as mail.example.org
  • Main user account on the mail server: john@example.org
  • Thunderbird:
    • Default identity: name: John Doe, email: john@example.com
    • Alias identity: name: John Doe, email: john@example.net

The first time I tried this, I used the account "john@example.org" for outgoing email and the SMTP server "mail.example.org" because this was the real FQDN, and the account worked fine in the past. But in this case DKIM failed.

The solution was to define different SMTP server options for each address:

  • identity john@example.com: SMTP server: mx.example.com, username: john@example.com (and its password)
  • identity john@example.net: SMTP server: mx.example.net, username: john@example.net (and its own password)

Then select the correct outgoing SMTP server in the Thunderbird account settings.

You can test the configuration with https://www.mail-tester.com/?lang=en (note - there are only three free checks per day).

Maybe this will help. In my case it was actually not a problem with the Postfix or SMTP server settings, but just with using the correct address settings when sending mail.

Kind regards, Ralf

7
  • thanks a lot for your response, maybe my situation is not as diffcult as your situation, I only work for one domain, but there is something I just find, when i send an email at command line using sendmail command it works but when i send it using mail command it's not working is that can be a problem ? Mar 27 at 9:05
  • I think i get some clue, when i send an email at command line using sendmail command and i check log at mail.log it only use postfix, but when i send an email using thunderbird and i check again log at mail.log dovecot was involved, is that can be a problem ? is there some configuration to make dovecot also integrate to opendkim ? Mar 28 at 4:08
  • As far as I know dovecot is only responsible for IMAP and can be used for authentication and local delivery, but if you send an email to an external mailserver, Postfix in involved. I still think that the problems are related to the user accounts. In your log above the first received line in the sendmail example says: Received: by mail.coderproject.my.id (Postfix, from userid 1001) id 4D63463641; [...] while Thunderbird refers to: Received: from [192.168.1.101] (unknown [182.2.141.212]) by mail.coderproject.my.id (Postfix) with ESMTPSA id E453C63641 for <mygmailaccount@gmail.com>; Mar 29 at 1:00
  • I guess that uid 1001 is your local user on the system. How does it refer to the IMAP account you're using with dovecot and Thunderbird? What's your mailserver configuration, did you setup it manually or used some helper like ISPConfig, ISPmail guide, mailcow or something else? Mar 29 at 1:09
  • I setup postfix using this reference linuxbabe.com/mail-server/setup-basic-postfix-mail-sever-ubuntu and then i setup dovecot using this reference linuxbabe.com/mail-server/… and then for setup dkim i follow this reference ubuntu.tutorials24x7.com/blog/… and then i read a reference from a forum for install amavis i follow this reference forum.iredmail.org/… Mar 29 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.