Strange problem using Gmail as mail server in ASP.NET

Discussion in 'ASP .Net' started by MMAS, Oct 14, 2006.

  1. MMAS

    MMAS Guest

    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);
     
    MMAS, Oct 14, 2006
    #1
    1. Advertising

  2. Google does not have a service for that, you will never accomplish this
    cause Google Mail block external access from the Mail Servers

    --

    Bruno Alexandre
    København, Danmark

    "a Portuguese in Denmark"

    Blog. http://balexandre.blogspot.com/
    Photos. http://www.flickr.com/photos/balexandre/


    "MMAS" <> wrote in message
    news:...
    > 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);
    >
     
    Bruno Alexandre, Oct 14, 2006
    #2
    1. Advertising

  3. MMAS

    MMAS Guest

    sorry, but as i said in the message, that code works 100% if I use one
    particular gmail account I have. I created a new account and tried
    using that instead, but it does NOT work. besides the
    username/password, the code doesn't change between those accounts.


    On Oct 14, 5:01 am, "Bruno Alexandre" <> wrote:
    > Google does not have a service for that, you will never accomplish this
    > cause Google Mail block external access from the Mail Servers
    >
    > --
    >
    > Bruno Alexandre
    > København, Danmark
    >
    > "a Portuguese in Denmark"
    >
    > Blog.http://balexandre.blogspot.com/
    > Photos.http://www.flickr.com/photos/balexandre/
    >
    > "MMAS" <> wrote in messagenews:...
    >
    > > 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);
     
    MMAS, Oct 15, 2006
    #3
  4. MMAS

    sloan Guest

    See my
    http://sholliday.spaces.live.com/blog/ 2/8/2006 ENTRY

    I have 1.1 and 2.0 gmail/google mail smtp setup.




    "MMAS" <> wrote in message
    news:...
    > 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/smtpauthe
    nticate";,
    > "1");
    >

    mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusern
    ame";,
    > "[email address]");
    >

    mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassw
    ord";,
    > "some_pass");
    > // - smtp.gmail.com use port 465 or 587
    >

    mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserve
    rport";,
    > "465");
    > // - smtp.gmail.com use STARTTLS (some call this SSL)
    >

    mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusess
    l";,
    > "true");
    >
    > SmtpMail.Send(mmAlert);
    >
     
    sloan, Oct 17, 2006
    #4
  5. sorry, I can't see
    your page crash Firefox completly!

    I get an error and have to restart firefox.


    good page :)

    i'm using firefox 1.5.0.7

    --

    Bruno Alexandre
    København, Danmark

    "a Portuguese in Denmark"

    Blog. http://balexandre.blogspot.com/
    Photos. http://www.flickr.com/photos/balexandre/


    "sloan" <> wrote in message
    news:%...
    > See my
    > http://sholliday.spaces.live.com/blog/ 2/8/2006 ENTRY
    >
    > I have 1.1 and 2.0 gmail/google mail smtp setup.
    >
    >
    >
    >
    > "MMAS" <> wrote in message
    > news:...
    >> 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/smtpauthe
    > nticate";,
    >> "1");
    >>

    > mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusern
    > ame";,
    >> "[email address]");
    >>

    > mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassw
    > ord";,
    >> "some_pass");
    >> // - smtp.gmail.com use port 465 or 587
    >>

    > mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserve
    > rport";,
    >> "465");
    >> // - smtp.gmail.com use STARTTLS (some call this SSL)
    >>

    > mmAlert.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusess
    > l";,
    >> "true");
    >>
    >> SmtpMail.Send(mmAlert);
    >>

    >
    >
     
    Bruno Alexandre, Oct 19, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Dalberg
    Replies:
    1
    Views:
    2,667
    =?Utf-8?B?U2l2YSBN?=
    Sep 19, 2005
  2. Replies:
    4
    Views:
    55,576
  3. Replies:
    15
    Views:
    156,377
    abhishek-technicalwork
    Jul 11, 2012
  4. jack
    Replies:
    9
    Views:
    556
    George Ter-Saakov
    Feb 8, 2008
  5. Brian Rhiel
    Replies:
    1
    Views:
    197
    Hassan Schroeder
    May 31, 2010
Loading...

Share This Page