我已经在 Ubuntu 服务器上安装了 Postfix 并配置了 DKIM。我已经在https://www.appmaildev.com/en/dkim结果很好。但是,我感到困惑的是,为什么只有当我使用语法直接通过服务器命令行发送时才会检测到 DKIM ,而当我使用 Thunderbird 发送电子邮件时却检测不到 DKIM。我在这里遗漏了什么?echo "hello" | sendmail [email protected]
如果我通过命令行发送,这就是原始消息
Delivered-To: [email protected]
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) [email protected] header.s=dkim header.b="DK/rg7gw";
spf=pass (google.com: domain of [email protected] designates 103.56.149.104 as permitted sender) [email protected];
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=coderproject.my.id
Return-Path: <[email protected]>
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 <[email protected]>
(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 [email protected] designates 103.56.149.104 as permitted sender) client-ip=103.56.149.104;
Authentication-Results: mx.google.com;
dkim=pass (test mode) [email protected] header.s=dkim header.b="DK/rg7gw";
spf=pass (google.com: domain of [email protected] designates 103.56.149.104 as permitted sender) [email protected];
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: [email protected]
Content-Type: image/jpeg
Content-Disposition: attachment; filename=COBA.jpg
Content-Transfer-Encoding: base64
Message-Id: <[email protected]>
Date: Mon, 20 Mar 2023 20:46:00 +0000 (UTC)
From: myaccount Bahar <[email protected]>
如果我通过 thunderbird 电子邮件客户端发送,这就是原始消息
Delivered-To: [email protected]
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 [email protected] designates 103.56.149.104 as permitted sender) [email protected];
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=coderproject.my.id
Return-Path: <[email protected]>
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 <[email protected]>
(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 [email protected] 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 [email protected] designates 103.56.149.104 as permitted sender) [email protected];
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 <[email protected]>; Mon, 20 Mar 2023 20:55:08 +0000 (UTC)
Content-Type: multipart/alternative; boundary="------------6D70L2ROq60OF2n6AabTQzgl"
Message-ID: <[email protected]>
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: [email protected]
From: myaccount Bahar <[email protected]>
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:[email protected]" 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: <[email protected]>
Content-Transfer-Encoding: base64
--------------S6Ey91uKS7BRtwsdBF6peNf4--
--------------6D70L2ROq60OF2n6AabTQzgl--
答案1
我在使用 Thunderbird 和邮件服务器时也遇到了类似的问题。情况如下:
- 使用 ISPconfig 和多个域配置自己的邮件服务器。
- 我使用了一个主邮件地址,但在 Thunderbird 中定义了一些别名地址,因此我可以使用不同的发件人地址。
- 对于外发邮件,我只定义了主帐户的用户名(邮件地址),因此 SMTP 登录使用每个邮件地址的相同数据来处理。
就我的情况而言,这正是导致问题的原因。
我必须更改 Thunderbird 中使用的每个身份的传出 SMTP 服务器,以便 SMTP 登录与发件人地址匹配。
一个简单的例子:
- 邮件服务器的 FQDN:mail.example.org
- 每个域名在 DNS 中都有自己的 MX 记录,因此 mx.example.com 和 mx.example.net 具有与 mail.example.org 相同的 IP 地址
- 邮件服务器上的主要用户帐户:[电子邮件保护]
- 雷鸟:
我第一次尝试这个时,我使用了帐户“[电子邮件保护]“用于发送电子邮件和 SMTP 服务器“mail.example.org”,因为这是真正的 FQDN,并且该帐户过去运行良好。但在这种情况下,DKIM 失败了。
解决方案是为每个地址定义不同的 SMTP 服务器选项:
- 身份[电子邮件保护]:SMTP 服务器:mx.example.com, 用户名:[电子邮件保护](及其密码)
- 身份[电子邮件保护]:SMTP 服务器:mx.example.net, 用户名:[电子邮件保护](及其自己的密码)
然后在 Thunderbird 帐户设置中选择正确的传出 SMTP 服务器。
您可以使用以下方式测试配置https://www.mail-tester.com/?lang=en(注意 - 每天仅有三次免费检查)。
也许这会有所帮助。就我而言,这实际上不是 Postfix 或 SMTP 服务器设置的问题,而是发送邮件时使用正确的地址设置的问题。
诚挚问候,拉尔夫