Some time our emails bounce from SMTP SERVER. when i analysis the problem i got three way to send mail. with free SMTP SERVER like gmail. etc server OR USING CDOSYS OR CDONTS. BUT the question: "Why should I switch to CDOSYS when my current CDONTS code works great?". Let me give a few reasons:
* CDONTS has been deprecated in IIS5 and is completely removed from Windows Server 2003, and even Windows XP. Yes, it is
possible to install on Windows Server 2003 but with the performance improvements and other enhancements, there should be no
need to do so.
* CDOSYS carries less overhead than CDONTS.
* HTML functionality is much improved with automatic generation of the TextBody by just setting the HTMLBody property.
* There are some new properties and methods that should have been included with CDONTS but weren't.
in my earlier post i already explain the code of send mail via gmail server so now we will focus on.
STEP 1) AS WE DESCRIBED ABOVE THAT CDONTS.DLL ARE NO MORE OVER IN WINDOW FOLDER SO CONFIGURE IT WHITH THIS WAY
Start + Run, regsvr32 c:\cdonts.dll
Start + Run + cmd,
in command type and run
]regsvr32 [path for dll]
now add refference of cdonts.dll
CDONTS.NewMail mailsend1 = new CDONTS.NewMail();
string From = "email@example.com";
string Subject = "xxxxxxxxxxxxxxxxxxxxxx";
string Body = "[html][body][table border=0 cellpading=0 cellspacing=0][tr][td]hi from
string To = "firstname.lastname@example.org";
mailsend1.BodyFormat = 0;
mailsend1.MailFormat = 0;
mailsend1.Importance = Convert.ToInt32(CDONTS.CdoImportance.CdoHigh);
mailsend1.Send(From, To, Subject, Body, 1);
how to implement second dll CDOSYS
we can also configure cdosys dll with same way as codonts.dll
MailMessage eMail = new MailMessage();
eMail.To = "email@example.com";
eMail.Subject = " 2222222222";
eMail.Body = "[html][table][tr][td]HI THIS MAIL FROM CDOSYS SO HOW ARE YOU[/td][/tr][/table]";
// Smtp configuration
eMail.From = "firstname.lastname@example.org";
SmtpMail.SmtpServer = "smpt.domain.com";
eMail.BodyFormat = MailFormat.Html;