M
MMAS
I've got my .net application set up to use gmail as a mail server (see
code below). Everything works quite well, actually, EXCEPT for one
particular email account. I've created an "admin" account that I'd like
to use to send emails from since GMail automatically replaces the
"from" field with whoever you're using to send emails from. When I use
this account, I get the following exception(s) (inner ones are
unraveled):
Could not access 'CDO.Message' object.
Exception has been thrown by the target of an invocation.
The message could not be sent to the SMTP server. The transport error
code was 0x80040217. The server response was not available
When i use my own personal gmail account, all is well. I have indeed
confirmed that my username and password are correct. Any ideas?
Thanks!
-MMAS
//code example
MailMessage mmAlert = new MailMessage();
mmAlert.From = strSenderEmail;
mmAlert.To = strRecipientEmail;
mmAlert.Priority = MailPriority.Normal;
SmtpMail.SmtpServer = "smtp.gmail.com";
// - smtp.gmail.com use smtp authentication
mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate";,
"1");
mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername";,
"[email address]");
mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword";,
"some_pass");
// - smtp.gmail.com use port 465 or 587
mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport";,
"465");
// - smtp.gmail.com use STARTTLS (some call this SSL)
mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl";,
"true");
SmtpMail.Send(mmAlert);
code below). Everything works quite well, actually, EXCEPT for one
particular email account. I've created an "admin" account that I'd like
to use to send emails from since GMail automatically replaces the
"from" field with whoever you're using to send emails from. When I use
this account, I get the following exception(s) (inner ones are
unraveled):
Could not access 'CDO.Message' object.
Exception has been thrown by the target of an invocation.
The message could not be sent to the SMTP server. The transport error
code was 0x80040217. The server response was not available
When i use my own personal gmail account, all is well. I have indeed
confirmed that my username and password are correct. Any ideas?
Thanks!
-MMAS
//code example
MailMessage mmAlert = new MailMessage();
mmAlert.From = strSenderEmail;
mmAlert.To = strRecipientEmail;
mmAlert.Priority = MailPriority.Normal;
SmtpMail.SmtpServer = "smtp.gmail.com";
// - smtp.gmail.com use smtp authentication
mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate";,
"1");
mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername";,
"[email address]");
mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword";,
"some_pass");
// - smtp.gmail.com use port 465 or 587
mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport";,
"465");
// - smtp.gmail.com use STARTTLS (some call this SSL)
mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl";,
"true");
SmtpMail.Send(mmAlert);