Friday, January 2, 2009

Why should I switch to CDOSYS when my current CDONTS code works great? send mail from cdosys and cdonts

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.

USE CDONTS.DLL


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
OR
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 = "helpondesk@blogspot.com";
string Subject = "xxxxxxxxxxxxxxxxxxxxxx";
string Body = "[html][body][table border=0 cellpading=0 cellspacing=0][tr][td]hi from

cdonts[/td][/tr][/table][/body][/html]";
string To = "helpondesk@blogspot.com";
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

using System.Web.Mail;

MailMessage eMail = new MailMessage();
eMail.To = "helpondesk@blogspot.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 = "helpondesk@blogspot.com";
eMail.Fields.Add(CDO.CdoConfiguration.cdoSMTPAuthenticate, "1");
eMail.Fields.Add(CDO.CdoConfiguration.cdoSendUserName, "helpondesk@blogspot.com");
eMail.Fields.Add(CDO.CdoConfiguration.cdoSendPassword, "mypwd");
SmtpMail.SmtpServer = "smpt.domain.com";
eMail.BodyFormat = MailFormat.Html;
SmtpMail.Send(eMail);


Thanks
HelpOnDesk Team

No comments: