As this is my first time using C#, I thought that migrating something to C# would be the best for me to learn. Well, I happen to pick something that although portions are on the Internet, the full monte was not unless you want to pay money for it (and the code): grr. So putting it all together became the next task.
Using the Code
I tried to make it as simple as possible (mainly because I was learning as I did it), but to use it, simply reference the DigSigs.dll in your project and do what I did below (maybe add some tags to the HTMLBody if you use it), compile it and execute it. You could do a lot more with this from a console or GUI and make it much better than it is at this point, so I will leave it to you ... enjoy!
Collapse
using System;
using System.Collections.Generic;
using System.Text;
namespace DSEMails
{
class Program
{
static void Main(string[] args)
{
DigSigs.CDOEmailer email = new DigSigs.CDOEmailer();
email.To = "email address";
email.From = "email address";
email.CC = "email address";
email.Signature = "name of signature";
email.Subject = "Digital Signing Test";
email.TheStore = "My";
email.SMTPServer = "SMTP Server or IP Address";
email.Body = "This is the BODY of the message!!";
email.HTMLBody = "This is the BODY of the message!!";
email.SMTPPort = 25;
email.Important = 2;
email.PlainText = false;
email.TimeOut = 120;
email.UseMachineStore = false;
email.Debug = true;
if (email.SendTo())
{ Console.WriteLine("\nSigned and sent...\n"); }
else
{ Console.WriteLine("\nError: Failed to send email?\n"); }
}
}
}
There are two classes:
DigSigs.CAPIWrap() which does all the signing
DigSigs.CDOEmailer() that is used to send the Emails