Results 1 to 4 of 4
  1. #1
    ownlikeaboss is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    3

    Getting error 80040213 trying to mail

    I found this piece of code and tried to use it but it doesn't work. Any help pls?



    Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
    Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).


    Const cdoAnonymous = 0 'Do not authenticate
    Const cdoBasic = 1 'basic (clear-text) authentication
    Const cdoNTLM = 2 'NTLM


    Set objMessage = CreateObject("CDO.Message")
    objMessage.Subject = "Example CDO Message"
    objMessage.From = """me"" <me@gmail.com>"
    objMessage.To = "me@gmail.com"
    objMessage.TextBody = "This is some sample message text.." & vbCrLf & "It was sent using SMTP authentication."


    '==This section provides the configuration information for the remote SMTP server.


    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort


    'Name or IP of Remote SMTP Server
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"


    'Type of authentication, NONE, Basic (Base64 encoded), NTLM
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic


    'Your UserID on the SMTP server
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username@gmail.com"


    'Your password on the SMTP server
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "pass"


    'Server port (typically 25)
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465


    'Use SSL for the connection (False or True)
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True


    'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60


    objMessage.Configuration.Fields.Update


    '==End remote SMTP server configuration section==


    objMessage.Send

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Why doesn't it work - error message, wrong results, nothing happens? What line triggers error? Step debug. Refer to link at bottom of my post for guidance on debug techniques.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ownlikeaboss is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    3
    I click the button need to wait like 1 minut then i get an error, the error is named 80040213 and i get it in the last line objMessage.Send, nothing else happens.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Your gMail ID is 'Me'?

    Here is another code example for gmail. http://www.emailarchitect.net/forum/...?g=posts&t=130
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 09-14-2012, 10:27 AM
  2. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  3. Sending Report via E-mail Error
    By Nettie in forum Access
    Replies: 8
    Last Post: 04-06-2012, 12:15 PM
  4. Replies: 11
    Last Post: 09-12-2011, 11:30 AM
  5. Sending Outlook E-mail - Run-time error '429'
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 03-01-2011, 09:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums