Mailkit 将垃圾数据添加到 HTML 电子邮件
Mailkit adds garbage data to HTML e-mail
当我使用 MailKit 在 C# 程序中发送电子邮件(HTML)时,电子邮件中附加了以下文本。到目前为止只发生过一次,我不知道是什么原因。
. +OK 4846 octets Return-Path: Received: from REDACTED by REDACTED
with LMTP id oCz8LJ/vJV1c/gAAu9w7lQ (envelope-from ); Wed, 10 Jul 2019
11:01:03 -0300 Return-path: Envelope-to: REDACTED Delivery-date: Wed,
10 Jul 2019 11:01:03 -0300 Received: from mail-qk1-f176.google.com
([209.85.222.176]:41045) by REDACTED with esmtps
(TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from )
id 1hlD9W-000Gyy-HM for sistemas@alpha2000.com; Wed, 10 Jul 2019
11:01:03 -0300 Received: by mail-qk1-f176.google.com with SMTP id
v22so1924865qkj.8 for ; Wed, 10 Jul 2019 07:00:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com;
s=20161025; h=message-id:date:mime-version:from:to:subject
:content-transfer-encoding;
bh=brObbSje35N7xVFbs7xQUyaaQ4xVQmOUwn98DaoeEnk=;
b=cnwCd46odf63vnU4HcqwMQgezOgcBnwL73XtadMXNG8El0kcsFlzPh8ACo22v23dxD
TnlMUq7o1MV/BcYbUpWh5RgDZyVaS/hCQZ/RCPzOvoULZ4lcAvZ9lgpnYfh1im+W+PjC
DV+TyTwSil6U0bNu1jLNWmHpZUOQe+kS05/TVt0XmdyGpbQUP80QJfQaADQPOWxwTs5R
XihyZkGzsmlCmb4/KVpBKIbJsKayoHr6bVSosa0ZyfxeKz5YXUClXbgFEmaeDwB9XmPo
D1aJnV8Hta5LYt1+qom2YN8J45pHwB/dC4+Y0YNmSwH0YHV1TcD9vEtTjHqeJyaQTJCS
6THg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:message-id:date:mime-version:from:to:subject
:content-transfer-encoding;
bh=brObbSje35N7xVFbs7xQUyaaQ4xVQmOUwn98DaoeEnk=;
b=KkDQIkc688QT7jbkJLm1KF5qzreiTIrGNt8iXJ0hn8n7NzbNv3vxIXI/bEFHsuFdZ9
RpCrMl1cTH77eWi/VeLyN0PlkIwmOHrDYpcLp6Gfn4fN7KGWmnQ3K7MtrE+ZkjB3eOwy
Mb8a1+J/m/EkO1t/Uv56X3jGBbvldQ667pFnWDogJa4CVepDhVcbt1zmiEAsSVa5VBSg
CeUJRG1fvNqXVU6juav6Ma/XE/93XYDslUzw+sGG7KwKNeMCbmNo+Vjjs5KlsROMUk7r
BpAyLXr5ZLF84kaaU8kA5mtTTUvfcCGBKEusOg44FkMrax0gB2F1ldnCR7fGqHNnib4I
gv8g== X-Gm-Message-State:
APjAAAVq3Xd90dlf11F6BemubaLr3s9iQWfey6GHVr5dKOZqguxX9Rp2
knYMCxA0kSETdrINF4RBixBDngnf X-Google-Smtp-Source:
APXvYqzZOgYRWFctT11UUkmeskaxTEeiaaRWwmOIc5znfZbEUbphIvWOgvPVJ7In3ow4SDr8qbV+nQ==
X-Received: by 2002:ae9:de05:: with SMTP id
s5mr21772108qkf.184.1562767205852; Wed, 10 Jul 2019 07:00:05 -0700
(PDT) Received: from REDACTED by smtp.gmail.com with ESMTPSA id
s11sm1062274qkm.51.2019.07.10.07.00.04 for (version=TLS1
cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Jul 2019 07:00:05
-0700 (PDT) Message-ID: Date: Wed, 10 Jul 2019 07:00:05 -0700 (PDT) X-Google-Original-Date: 10 Jul 2019 07:00:03 -0700 MIME-Version: 1.0
From: REDACTED To: REDACTED Subject: Resumen Content-Type: text/html;
charset=us-ascii Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=1.1 X-Spam-Score: 11 X-Spam-Bar: +
X-Ham-Report: Spam detection software, running on the system
"REDACTED", has NOT identified this incoming email as spam. The
original message has been attached to this so you can view it or label
similar future email. If you have any questions, see root@localhost
for details. Content preview: ok - REDACTED.pdf ok - REDACTED.pdf
Content analysis details: (1.1 points, 5.0 required) pts rule name
description ---- ----------------------
-------------------------------------------------- 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.5039] -0.0 SPF_PASS SPF:
sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly
abused enduser mail provider (seguimiento.alpha[at]gmail.com) 0.0
HTML_MESSAGE BODY: HTML included in message 0.1 MIME_HTML_ONLY BODY:
Message only has text/html MIME parts 0.1 DKIM_SIGNED Message has a
DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message
has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message
has a valid DKIM or DK signature from envelope-from domain -0.1
DKIM_VALID_AU Message has a valid DKIM or DK signature from author's
domain 0.4 HTML_MIME_NO_HTML_TAG HTML-only message, but there is no
HTML tag X-Spam-Flag: NO ok - REDACTED.pdf=0A
ok - 19008PET1001821M.pdf=0A
这是创建电子邮件的代码:
var mimeMessage = new MimeMessage();
mimeMessage.From.Add(new MailboxAddress(emailSettings.SmtpConfig.FromName, emailSettings.SmtpConfig.From));
mimeMessage.To.AddRange(direcciones.Select(d => new MailboxAddress(d)));
mimeMessage.Bcc.Add(new MailboxAddress(emailSettings.SmtpConfig.From));
mimeMessage.Subject = titulo;
var bodyBuilder = new BodyBuilder
{
HtmlBody = html
};
mimeMessage.Body = bodyBuilder.ToMessageBody();
using (var client = new SmtpClient())
{
await client.ConnectAsync(emailSettings.SmtpConfig.Host, emailSettings.SmtpConfig.Port, emailSettings.SmtpConfig.UseSsl);
await client.AuthenticateAsync(emailSettings.SmtpConfig.UserName, emailSettings.SmtpConfig.Password);
await client.SendAsync(mimeMessage);
await client.DisconnectAsync(true);
}
我用 Outlook 2013 查看了邮件。
如果您查看邮件 headers,很明显您的垃圾邮件检测软件修改了邮件(因为 headers 这么说)。这与 MailKit 无关。
当我使用 MailKit 在 C# 程序中发送电子邮件(HTML)时,电子邮件中附加了以下文本。到目前为止只发生过一次,我不知道是什么原因。
. +OK 4846 octets Return-Path: Received: from REDACTED by REDACTED with LMTP id oCz8LJ/vJV1c/gAAu9w7lQ (envelope-from ); Wed, 10 Jul 2019 11:01:03 -0300 Return-path: Envelope-to: REDACTED Delivery-date: Wed, 10 Jul 2019 11:01:03 -0300 Received: from mail-qk1-f176.google.com ([209.85.222.176]:41045) by REDACTED with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1hlD9W-000Gyy-HM for sistemas@alpha2000.com; Wed, 10 Jul 2019 11:01:03 -0300 Received: by mail-qk1-f176.google.com with SMTP id v22so1924865qkj.8 for ; Wed, 10 Jul 2019 07:00:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:mime-version:from:to:subject :content-transfer-encoding; bh=brObbSje35N7xVFbs7xQUyaaQ4xVQmOUwn98DaoeEnk=; b=cnwCd46odf63vnU4HcqwMQgezOgcBnwL73XtadMXNG8El0kcsFlzPh8ACo22v23dxD TnlMUq7o1MV/BcYbUpWh5RgDZyVaS/hCQZ/RCPzOvoULZ4lcAvZ9lgpnYfh1im+W+PjC DV+TyTwSil6U0bNu1jLNWmHpZUOQe+kS05/TVt0XmdyGpbQUP80QJfQaADQPOWxwTs5R XihyZkGzsmlCmb4/KVpBKIbJsKayoHr6bVSosa0ZyfxeKz5YXUClXbgFEmaeDwB9XmPo D1aJnV8Hta5LYt1+qom2YN8J45pHwB/dC4+Y0YNmSwH0YHV1TcD9vEtTjHqeJyaQTJCS 6THg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:mime-version:from:to:subject :content-transfer-encoding; bh=brObbSje35N7xVFbs7xQUyaaQ4xVQmOUwn98DaoeEnk=; b=KkDQIkc688QT7jbkJLm1KF5qzreiTIrGNt8iXJ0hn8n7NzbNv3vxIXI/bEFHsuFdZ9 RpCrMl1cTH77eWi/VeLyN0PlkIwmOHrDYpcLp6Gfn4fN7KGWmnQ3K7MtrE+ZkjB3eOwy Mb8a1+J/m/EkO1t/Uv56X3jGBbvldQ667pFnWDogJa4CVepDhVcbt1zmiEAsSVa5VBSg CeUJRG1fvNqXVU6juav6Ma/XE/93XYDslUzw+sGG7KwKNeMCbmNo+Vjjs5KlsROMUk7r BpAyLXr5ZLF84kaaU8kA5mtTTUvfcCGBKEusOg44FkMrax0gB2F1ldnCR7fGqHNnib4I gv8g== X-Gm-Message-State: APjAAAVq3Xd90dlf11F6BemubaLr3s9iQWfey6GHVr5dKOZqguxX9Rp2 knYMCxA0kSETdrINF4RBixBDngnf X-Google-Smtp-Source: APXvYqzZOgYRWFctT11UUkmeskaxTEeiaaRWwmOIc5znfZbEUbphIvWOgvPVJ7In3ow4SDr8qbV+nQ== X-Received: by 2002:ae9:de05:: with SMTP id s5mr21772108qkf.184.1562767205852; Wed, 10 Jul 2019 07:00:05 -0700 (PDT) Received: from REDACTED by smtp.gmail.com with ESMTPSA id s11sm1062274qkm.51.2019.07.10.07.00.04 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Jul 2019 07:00:05 -0700 (PDT) Message-ID: Date: Wed, 10 Jul 2019 07:00:05 -0700 (PDT) X-Google-Original-Date: 10 Jul 2019 07:00:03 -0700 MIME-Version: 1.0 From: REDACTED To: REDACTED Subject: Resumen Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=1.1 X-Spam-Score: 11 X-Spam-Bar: + X-Ham-Report: Spam detection software, running on the system "REDACTED", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see root@localhost for details. Content preview: ok - REDACTED.pdf ok - REDACTED.pdf Content analysis details: (1.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.5039] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (seguimiento.alpha[at]gmail.com) 0.0 HTML_MESSAGE BODY: HTML included in message 0.1 MIME_HTML_ONLY BODY: Message only has text/html MIME parts 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.4 HTML_MIME_NO_HTML_TAG HTML-only message, but there is no HTML tag X-Spam-Flag: NO ok - REDACTED.pdf=0A ok - 19008PET1001821M.pdf=0A
这是创建电子邮件的代码:
var mimeMessage = new MimeMessage();
mimeMessage.From.Add(new MailboxAddress(emailSettings.SmtpConfig.FromName, emailSettings.SmtpConfig.From));
mimeMessage.To.AddRange(direcciones.Select(d => new MailboxAddress(d)));
mimeMessage.Bcc.Add(new MailboxAddress(emailSettings.SmtpConfig.From));
mimeMessage.Subject = titulo;
var bodyBuilder = new BodyBuilder
{
HtmlBody = html
};
mimeMessage.Body = bodyBuilder.ToMessageBody();
using (var client = new SmtpClient())
{
await client.ConnectAsync(emailSettings.SmtpConfig.Host, emailSettings.SmtpConfig.Port, emailSettings.SmtpConfig.UseSsl);
await client.AuthenticateAsync(emailSettings.SmtpConfig.UserName, emailSettings.SmtpConfig.Password);
await client.SendAsync(mimeMessage);
await client.DisconnectAsync(true);
}
我用 Outlook 2013 查看了邮件。
如果您查看邮件 headers,很明显您的垃圾邮件检测软件修改了邮件(因为 headers 这么说)。这与 MailKit 无关。