I'm sending mails to users with attachments. Mails that aren't signed, get a .pdf file (around 64kb) and are working perfectly fine.
However, when I sign them for other users, the PDF file becomes around 64 B and can't be opened.
I'm not doing anything with the attachments while signing, however.. so this is very odd.
My code for signing:
email = SpecificMethods.DKIMSign(email);
internal static MailMessage DKIMSign(MailMessage email)
{
var privateKey = PrivateKeySigner.Create(@"-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----");
var domainKeySigner = new DomainKeySigner(privateKey, "***.com", "**", new string[] { "mime-version", "date", "subject", "from", "to", "content-type" });
email.DomainKeySign(domainKeySigner);
var dkimSigner = new DkimSigner(privateKey, "***.com", "**", new string[] { "mime-version", "date", "subject", "from", "to", "content-type" });
email.DkimSign(dkimSigner);
return email;
}
And eventually send it. Nothing special happening there.
Any reason why my attachment would 'break'??
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr. Stroustroupe.
C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.
C is more difficult to learn than JavaScript, but it's a valuable skill to have because most programming languages are actually implemented in C. This is because C is a “machine-level” language. So learning it will teach you how a computer works and will actually make learning new languages in the future easier.
I think that you shall change the library used to sign the messages or the class used to send the actual email. I tried a quick search for an alternate to System.Net.SmtpClient
but found none.
You did not specify which DLL package you used, so a Google search teleported me to this project
Unfortunately, if you look at the Readme...
As System.Net.Mail.SmtpClient generates boundary identifiers randomly and as this code hacks the SmtpClient to retrieve the full email content before sending the code cannot be used when sending with SmtpClient and the MailMessage when the MailMessage has an alternative view or an attachment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With