Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    kacocal is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2015
    Posts
    26

    How to send an email out by using MS Access 2007 but NOT through MS Outlook?

    Hi,

    I am wondering are there any method to send an email out by using MS Access 2007 but NOT through MS Outlook.

    I have looked through many of the websites and forums on the Internet, but nothing could help at this moment.

    If you have any idea, it would be greatly appreciated.

    Thank you.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    It will fire your default client email app. It doesn't have to be outlook. I myself use Windows Live Mail. But you do need to have a client based email app which is becoming less common with browser based email.

  4. #4
    kacocal is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2015
    Posts
    26
    Hi RuralGuy,

    I took a look at the website you sent to me and compare with some websites. I came up with the following codes:

    ================================
    Dim iCfg As Object
    Dim iMsg As Object

    Set iCfg = CreateObject("CDO.Configuration")
    Set iMsg = CreateObject("CDO.Message")

    With iCfg.Fields
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smpt.gmail.com"
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "my_login_name"
    .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "my_login_password"
    .Item("http://schemas.microsoft.com/cdo/configuration/sendemailaddress") = "my_gmail_emailaddress"
    .Update
    End With

    With iMsg
    .Configuration = iCfg
    .Subject = "Test"
    .To = "my_own_yahoo_account"
    .TextBody = "MessageBody. Just testing"
    .Send
    End With

    Set iMsg = Nothing
    Set iCfg = Nothing

    ================================================== ==

    However, after I ran this code for a while, an error message popped up:

    Run-time error '-2147220973 (80040213)':

    The transport failed to connect to the server.

    When I clicked on the 'Debug' button, the error stopped at the .Send command in the With and End With

    I am not sure whether my code was wrong or something. Can someone help me with this issue?

    Many thanks.

  5. #5
    kacocal is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2015
    Posts
    26
    One more thing, i am using MS Access 2007. Maybe there is some syntax error for the code above.

    If someone can let me know the exact VBA code, it will be greatly appreciated.

    Thank.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You might try adding these two lines:
    Code:
     
    'Use SSL for the connection (False or True)
    .Item("http://schemas.microsoft.com/cdo/con...ion/smtpusessl") = False
    'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
    .Item("http://schemas.microsoft.com/cdo/con...nectiontimeout") = 60

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    RuralGuy, your schemas are truncated by the hyperlink feature.

  8. #8
    kacocal is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2015
    Posts
    26
    RuralGuy,

    I put these line of codes into my Access VBA code as you mentioned:

    'Use SSL for the connection (False or True)
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
    'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

    But it still gave me the same message error.

    Are these codes in VBScript? If so, how can I translate all these VBScript codes into MS Access VBA codes?

    Thanks,

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The missing half...:
    .Item("cdo/configuration/smtpusessl") = False
    .Item("cdo/configuration/smtpconnectiontimeout") = 60

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    They are VBA code! I've been using them for years. Are you sure you're not having a problem with your SMTP server?

  11. #11
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    It might be a server port thing, 465

    Here is a reference. This post is not the complete solution, but adding the smtpusessl seemed to solve the problem using Gmail in that thread.
    https://www.accessforums.net/program...tml#post295346

  12. #12
    kacocal is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2015
    Posts
    26
    RuralGuy,

    I don't think it is the code problem. I think it is the SMTP server problem. However, I don't know what the problem is. Do you know the IP address for gmail, yahoo or hotmail?

    Thanks,

  13. #13
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'm sorry but I do not. My Goggling has not turned up any other ideas either.

  14. #14
    kacocal is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2015
    Posts
    26
    Thank you RuralGuy.

    But I think it is the SMTP server problem. Do I need to setup or configure the SMTP server on my own pc first and then run the VBA code?

    Thanks,

  15. #15
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I honestly do not know. I have never used CDO with Gmail before. Sorry.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 09-14-2015, 07:24 AM
  2. Replies: 2
    Last Post: 01-30-2015, 09:08 AM
  3. Replies: 3
    Last Post: 11-12-2014, 11:52 AM
  4. Replies: 5
    Last Post: 04-25-2013, 10:36 AM
  5. Send email from Access thru Outlook
    By ZMAN in forum Forms
    Replies: 2
    Last Post: 11-27-2010, 06:10 PM

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