Free Support Forum - aspose.com

Email DKIM


#1

Hi,

when I use the the method DKIMSign of ASPOSE.Email to send an email with DKIM, but I open the mail at gmail,
It always show “dkim=neutral (body hash did not verify)”, I need your professional support

There are three point to explain my situation below :

  1. Here is the code I use to sign the email : MyCode.txt
  2. Here is the email original content : MyEDM500.eml
  3. Here is the dns setting (Query result of command line) : DNS Setting.txtEmail DKIM.zip (3.7 KB)

#2

@carlos_liu,

I have observed your above comments and request you to please further elaboration of above point in along with snapshot. Can you please also share information what result you are intending to achieve on your end with this.


#3

You can unzip the file “Email DKIM.zip” first, it contains the following document, and it is more detail then snapshot.

I explain more detail as follows :

  1. Here is the code I use to sign the email : MyCode.txt <-- I use this code to generate the
    DKIM Header, and you can see the header infomation in file “MyEDM500.eml”
  2. Here is the email original content : MyEDM500.eml <-- this is the eml file that I send to gmail with DKIM, and I download from gmail. when you open the file, it shows “dkim=neutral (body hash did not verify)” at the part of “Authentication-Results”
  3. Here is the dns setting (Query result of command line) : DNS Setting.txt <-- I use nslookup to find the dns “txt record” that I set for the DKIM

#4

@carlos_liu,

Thank you for sharing the information. We have created an issue with ID EMAILNET-39462 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.


#5

@carlos_liu,
To fix issue (body hash did not verify) you need to change your code in a such way:

		...........................................................
		//MailMessage.HtmlBody = dto.MailMessage.HtmlBody;
		//string FilteredHTML = dto.MailMessage.HtmlBody.Replace("<html>", "").Replace("</html>", "").Replace("\r\n", "\n");
		//var AltViewHTML = AlternateView.CreateAlternateViewFromString("TEST", Encoding.UTF8, System.Net.Mime.MediaTypeNames.Text.Plain);
		//AltViewHTML.TransferEncoding = Aspose.Email.Mime.TransferEncoding.QuotedPrintable;
		//MailMessage.AlternateViews.Add(AltViewHTML);
		MailMessage.Body = "TEST";
		.............................................................

Regards,
Alexander Pavov,
Aspose.Email .Net developer


#6

if the content is plain/text, the the DKIM is pass. the code used as follows :
MailMessage.Body = “TEST”;

but, if the content is html , the DKIM is still fail, the code used as follows:
MailMessage.HtmlBody = “<a href=“www.google.com”>Google web site<a href=“www.ibanff.tw”>Banff web site<a href=“www.dajinsoft.com”>Dajinsoft web site”;


#7

@carlos_liu,

Thank you for sharing additional details. We will share feedback with you as soon as the issue will be fixed.


#8

Need to set IsBodyHtml explicit.Please try:

MailMessage.HtmlBody =

`> “<a href=“www.google.com”>Google web site<a href=“www.ibanff.tw”>Banff web site<a href=“www.dajinsoft.com”>Dajinsoft web site”;`

MailMessage.IsBodyHtml = true;

Regards,
Alexander Pavov,
Aspose.Email .Net developer


#9

I have tried the code : MailMessage.IsBodyHtml = true;

but it still fail, you can see the original content of the eml file with the snapshot

myedm801.png (135.2 KB)


#10

@carlos_liu,

Thank you for sharing the information. I have updated information in our issue tracking system and will get back to you with feedback as soon as possible.