use DotNetOpenMail in other project

Mar 26, 2012 at 12:22 PM

Hi,

I'm trying to use the DotNetOpenMail.dll library but I have an exception:

              DotNetOpenMail.EmailMessage dotMe = new DotNetOpenMail.EmailMessage();
                dotMe.HeaderEncoding = DotNetOpenMail.Encoding.EncodingType.QuotedPrintable;
                dotMe.HeaderCharSet = System.Text.Encoding.UTF8;
                dotMe.Subject = "dotNet Test";
                dotMe.AddToAddress("user@mailserver.com");
                dotMe.HtmlPart = new DotNetOpenMail.HtmlAttachment("<html><p><b>Body</b>");
                dotMe.HtmlPart.CharSet = System.Text.Encoding.UTF8;
                dotMe.HtmlPart.Encoding = DotNetOpenMail.Encoding.EncodingType.QuotedPrintable;
                //var msgStream = new MemoryStream();
                //var sw = new StreamWriter(msgStream);
                string res = dotMe.ToDataString();
                StreamWriter sw = new StreamWriter("dotNetPruebaOutlook.msg");
                sw.Write(res);

Exception: "Object reference not set to an instance of an object."
        at DotNetOpenMail.EmailMessage.GetStandardHeaders(Encoding charset, IEncoder encoder)