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"] = "[email protected]";
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") = "[email protected]"
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 = "[email protected]"
objMail.To = "[email protected]"
objMail.Subject = "Message from the website"
objMail.HTMLBody = "Welcome to our website......"
objMail.Send
Set objMail = Nothing
Set objConf = Nothing