0
votes

When I sent an e-mail (with HTML) in a C# program using MailKit, the following text got appended to the e-mail. So far this has happened only once, and I have no idea what is the cause.

. +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 [email protected]; 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

Here is the code that creates the e-mail:

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);
        }

I viewed the e-mail with Outlook 2013.

1
Why do you think MailKit added junk to your message? How did you view this content? It looks to be part of a POP3 response and not just a message. What is your code to send this message? What is your code to view this message (or, alternatively, how are you getting this blob of text that you pasted into your question?) - jstedfast

1 Answers

2
votes

If you look at the message headers, it becomes obvious that your spam detection software modified the message (because the headers say so). This has nothing to do with MailKit.