-
-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dkim verification fails #251
Comments
You'll have to provide me with examples so I can see what is going wrong. Does MimeKit fail to verify them? Or is it some other program that fails to verify them? Which program? Is it before or after the message has been sent? etc. |
with the following code : #region [initialize the message]
var message = new MimeMessage();
message.From.Add(new MailboxAddress("", _message.From.Address));
message.To.Add(new MailboxAddress("", email.Key));
message.Subject = _message.Subject;
var builder = new BodyBuilder();
var plainText = ConvertHtml(_message.Body);
builder.TextBody = " تست ";
builder.HtmlBody = " <div> تست </div> ";
message.Body = builder.ToMessageBody();
#endregion
using (var client = new MailKit.Net.Smtp.SmtpClient())
{
#region [Smtp]
client.Connect(_smtpConfiguration.SmtpInfo.Host, _smtpConfiguration.Port, MailKit.Security.SecureSocketOptions.None);
client.Authenticate(_smtpConfiguration.Username, _smtpConfiguration.Password);
#endregion
#region [Sign the message]
var dkimSigner = new MimeKit.Cryptography.DkimSigner("key\\myDomain.pem", "myDomain.info", "selector");
List<HeaderId> headersToSign = new List<HeaderId>() { HeaderId.From, HeaderId.To };
message.Sign(dkimSigner, headersToSign, DkimCanonicalizationAlgorithm.Relaxed, DkimCanonicalizationAlgorithm.Relaxed);
#endregion
#region [Send]
var t = client.SendAsync(message);
t.Wait();
t.ContinueWith((tt) =>
{
if (!tt.IsFaulted)
{
OnSendComplete(null, null, email.Key, email.Value, "");
}
});
client.Disconnect(true);
#endregion
} after I sent the message to gmail I get the below text :
but I didn't verify the message with mimekit!! |
The problem seems to be that your mail server is modifying the message. Look at this. In your code, you set the HTML message body to this: builder.HtmlBody = " <div> تست </div> "; But when it arrives, it looks like this:
The mail server is also setting a |
oh my bad dear the below code is the result of that c# code :
// * : Editor recognizes the Divs here and doesn't show them . in edit mode there are Divs but when I save it, Divs hide |
You need to use 3 backticks, not 1 in order to get github to render raw text correctly. |
now look at this one : I used english text : test as subject and
|
Okay, so here's the problem. I was actually wrong about the However, the signature is being generated before the The problem is that the
|
In other words, you need to add this line of code to your program before calling message.Body.Prepare (EncodingConstraint.EightBit); |
I used |
Hi
I use Mimekit to sign my messages. When subject and body are English text. Dkim is being passed but when subject or body is Farsi Dkim fails .
Any clue or hint to solve it
Thanks
The text was updated successfully, but these errors were encountered: