Home | Support | Order Now | My Account | Login or Register | Contact UsContact Us
  Language 
PakHost Web Services
PakHost Web Services
You are here: Home > Support > Knowledgebase > Email Setup > How to send email using CDOSYS with ASP or ASP.NET code?
Toll Free (USA/Canada): 1-800-786-5171




PakHost Trust Seal
Knowledgebase > Email Setup > How to send email using CDOSYS with ASP or ASP.NET code?

How to send email using CDOSYS with ASP or ASP.NET code?

Here is a working example to Download.


// using System.Web.Mail;
eMail = new MailMessage();
eMail.BodyFormat = MailFormat.Text;
eMail.From = _SendFrom;
eMail.Fields[http://schemas.microsoft.com/cdo/configuration/smtpserver]="mail.yourdomain.com";
eMail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"]=25;
eMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"]=2;
if (SMTPUser != null && SMTPPassword != null)
{
eMail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"]=1;
eMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = "User@domain.com";
eMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"]="Password";
}
eMail.To = "recipients";
SmtpMail.SmtpServer = SMTPServerName;
SmtpMail.Send(eMail);


For ASP

 

Dim objMail, objConf
Set objMail = Server.CreateObject("CDO.Message")
Set objConf = Server.CreateObject ("CDO.Configuration")
objConf.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.yourdomain.com"
objConf.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objConf.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objConf.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
objConf.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "user@yourdomain.com"
objConf.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Password"
objConf.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objConf.Fields.Update

Set objMail.Configuration = objConf
objMail.From = "sales@yourdomain.com"
objMail.To = "customer@domain.com"
objMail.Subject = "Message from the website"
objMail.HTMLBody = "Welcome to our website......"
objMail.Send
Set objMail = Nothing
Set objConf = Nothing




Was this answer helpful?


  Add to Favourites
  Print this Article

We use Cisco Routers and Switches  We use Juniper NetScreen Firewall
Premium SSL Certificate