K
kamal
hi ,
When i tried to send mails by using smtp authentication it was giving an
exception
"Could not access 'CDO.Message' object.". can any body help me.
string smtpServer = "smtp.domain.com";
string userName = "userid";
string password = "password";
int cdoBasic = 1;
int cdoSendUsingPort = 2;
MailMessage msg = new MailMessage();
if (userName.Length > 0)
{
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver",
smtpServer);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport",
25) ;
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing",
cdoSendUsingPort) ;
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
cdoBasic);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
userName);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
password);
}
msg.To = "(e-mail address removed)";
msg.From = (e-mail address removed);
msg.Subject = "Hi ra";
msg.Body = "text";
SmtpMail.SmtpServer = smtpServer;
SmtpMail.Send(msg);
When i tried to send mails by using smtp authentication it was giving an
exception
"Could not access 'CDO.Message' object.". can any body help me.
string smtpServer = "smtp.domain.com";
string userName = "userid";
string password = "password";
int cdoBasic = 1;
int cdoSendUsingPort = 2;
MailMessage msg = new MailMessage();
if (userName.Length > 0)
{
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver",
smtpServer);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport",
25) ;
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing",
cdoSendUsingPort) ;
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
cdoBasic);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
userName);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
password);
}
msg.To = "(e-mail address removed)";
msg.From = (e-mail address removed);
msg.Subject = "Hi ra";
msg.Body = "text";
SmtpMail.SmtpServer = smtpServer;
SmtpMail.Send(msg);