Getting error while creating object of wodSmtpCom - WeOnlyDo Discussion board

Getting error while creating object of wodSmtpCom (wodSmtp)

by dipankar.haldar@ubs.com, Wednesday, June 03, 2015, 13:59 (3461 days ago)
edited by dipankar.haldar@ubs.com, Wednesday, June 03, 2015, 14:40

Here is my program -

public static void SendSecureMail(MemoryStream report, string sFileName, List<MailOrderTemplateToEntity> emailTo,
List<MailOrderTemplateCcEntity> emailCc, string subject, string mailtext,
bool checkTestMail, string testEmailUserLogin)
{
var ccAddress = "";
var toAddress = "";

var oSmtp = new WODSMTPCOMLib.wodSmtpCom();
var oCert = new WODCERTMNGLib.Certificate();

oSmtp.LicenseKey = "***************";

oCert.Load(HttpContext.Current.Server.MapPath("MailKeys") + "\\calltracker_cert.cer", "");
oCert.LoadKey(HttpContext.Current.Server.MapPath("MailKeys") + "\\calltracker_key.pem", "");

oSmtp.Certificate = oCert;

oSmtp.Hostname = Globals.SmtpServerSecure();
oSmtp.Security = SmtpSecurityEnum.SecurityImplicit;
oSmtp.Authentication = SmtpAuthentications.AuthNone;
oSmtp.Port = Convert.ToInt32(Globals.SmtpSecurePort());

// now we send the mail
if (!checkTestMail)
{
if (emailTo != null)
{
toAddress = emailTo.Aggregate(toAddress, (current, dataTo) => current + dataTo.Email + ";");
}


if (emailCc != null)
{
ccAddress = emailCc.Aggregate(ccAddress, (current, dataCc) => current + (dataCc.Email + ";"));
}
}
else
{
toAddress = testEmailUserLogin + ";";
ccAddress = testEmailUserLogin + ";";
}

oSmtp.Message.To = toAddress.Substring(0, toAddress.Length - 1);
// add cc if exists
if (ccAddress.Length > 0)
oSmtp.Message.CC = ccAddress.Substring(0, ccAddress.Length - 1);

//convert in html
mailtext = Parsetext(mailtext);
oSmtp.Message.HTMLText = "<HTML><BODY><FONT FACE='Arial' SIZE='2'>" + mailtext + "</FONT></BODY></HTML>";

oSmtp.Message.Subject = subject;
oSmtp.Message.From = Globals.SmtpMailFrom();


var memoryWriter = new StreamWriter(report);
memoryWriter.Write(report);
report.Seek(0, SeekOrigin.Begin);

//here we load the report on the server and attach on the message
report.Flush();
var sPathFileName=GetAttachFile(report, sFileName);
oSmtp.Message.Attach(sPathFileName, "application/vnd.ms-excel", AttachmentEncodingsEnum.encBASE64);


oSmtp.Blocking = true;
oSmtp.Connect();


oSmtp.Timeout = 60;
oSmtp.SendMessage();

if (oSmtp.State != SmtpStates.Disconnected)
oSmtp.SendCommand("QUIT\n\r");


oSmtp.Disconnect();

//delete file
File.Delete(sPathFileName);
}


I always get error online "var oSmtp = new wodSmtpCom();"
Retrieving the COM class factory for component with CLSID {0C62D803-DE43-4B3D-B259-00AB7AA46B84} failed due to the following error: 80040154.
---------------------------------------------------------------------------------
I tried -
regsvr32 Interop.WODCERTMNGLib.dll
regsvr32 Interop.WODSMTPCOMLib.dll

But still no luck. Not working at all. Need your immediate help.
---------------------------------------------------------------------------------
When I try below, also get error -
regsvr32 wodCertificate.dll
regsvr32 wodSmtp.dll

The module "wodCertificate.dll" was loaded but the call to DllRegisterServer failed with error code 0x8002801c.

The module "wodSmtp.dll" was loaded but the call to DllRegisterServer failed with error code 0x80020009.

Getting error while creating object of wodSmtpCom

by Jasmine, Wednesday, June 03, 2015, 15:56 (3461 days ago) @ dipankar.haldar@ubs.com

Hi Dipankar.

As administrator, please make sure you have wodSmtp.dll in SYSTEM32 or SYSWOW64, and wodSmtp64.dll in SYSTEM32 (if you're on x64 architecture).

Then do

regsvr32 wodSmtp.dll
regsvr32 wodSmtp64.dll

There should be no errors. If you get an error like in previous post, you are not the administrator, or you have invalid DLLs so please re-install wodSmtp on that computer and try again.

Kind regards,
Jasmine.