Sending CDO Email Using Gmail

Discussion in 'Site Programming, Development and Design' started by Jonathan Kinsman, Mar 16, 2018.

  1. I'm attempting to send email using CDO and Gmail in ASP Classic and get the following error:

    error '80040211'

    Here is my code. [gmail address], [gmail password], and [to address] have actual values, but I didn't want to post them here.

    Dim objMessage
    Dim objConfig
    Dim Flds

    set objMessage = createobject("cdo.message")
    set objConfig = createobject("cdo.configuration")
    Set Flds = objConfig.Fields

    Flds.Item("") = 2
    Flds.Item("") = ""

    ' Passing SMTP authentication
    Flds.Item ("") = 1 'basic (clear-text) authentication
    Flds.Item ("") ="[gmail address]"
    Flds.Item ("") ="[gmail password]"
    Flds.Item ("") = 465 'basic (clear-text) authentication
    Flds.Item ("") = 1
    Flds.Item ("") = 30

    Set objMessage.Configuration = objConfig
    objMessage.To = "[to address]"
    objMessage.From = "[gmail address]"
    objMessage.Subject = "Test"
    objMessage.HTMLBody = "This is a test sent from CDO using smtp authentication."


    Any ideas? Thanks!
  2. Elshadriel

    Elshadriel Winhost Staff

  3. Thanks! As a follow-up, I got the above code working by "enabling less secure apps" on G Suite.
    ComputerMan and Elshadriel like this.
  4. Elshadriel

    Elshadriel Winhost Staff

    Thanks for that follow-up, Jonathan. I'm sure it will help others in the future.

Share This Page