Results 1 to 4 of 4
  1. #1
    jons is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2011
    Posts
    3

    Access 2007 does not honor smtpserverport?

    In a module, I am using the following:



    Code:
    Public Sub SendGmail()
        Set cdomsg = CreateObject("CDO.message")
        With cdomsg.Configuration.Fields
            .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
            .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "mytestuser@gmail.com"
            .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "myHighlySecurePassword"
            .Update
        End With
        ' build email parts
        With cdomsg
            .To = "mytestuser@gmail.com"
            .From = "mytestuser@gmail.com"
            .Subject = "Message From Access"
            .TextBody = "This message sent from Microsoft Access 2007 via Gmail."
            .AddAttachment "c:\myexcelfile.xlsx"
            .Send
        End With
        Set cdomsg = Nothing
        
        MsgBox ("Sent the messsage")
    End Sub
    and when the email is triggered, it does not use port 587 as the code dictates. Instead port 25 is opened. I am using the free TCP port monitoring utility "currports" and can visually see port 25 opened by msaccess.exe.

    How can I get 587 to work?
    Last edited by jons; 02-15-2011 at 12:30 PM. Reason: fixed smtpserverport line

  2. #2
    jons is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2011
    Posts
    3
    After fixing the smtp typo in the smtpserverport line then changing the port to 465, this code now works!

  3. #3
    akaSleen is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    1
    Thank you, thank you!
    I've been trying to get Access to send from gmail for a week.
    I had been using the wrong port--how did you discover which one to use?

    Celine

  4. #4
    jons is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2011
    Posts
    3
    Quote Originally Posted by akaSleen View Post
    Thank you, thank you!
    I've been trying to get Access to send from gmail for a week.
    I had been using the wrong port--how did you discover which one to use?

    Celine
    There were code examples all over the Internet with a couple different ports to try. Problem was, almost everyone copy/pasted the code with the typo so for me, not proof reading the code closely was my hangup, not the port.

    How I found the typo was not by proof reading the code though. haha. I ran Microsoft Port Reporter on a system while testing the code, and concurrently ran WinTail against Microsoft Port Reporters output file then discovered port 25 was still being used even though I specified another port.

    Had I proofread... none of this would ever have happened.

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

Similar Threads

  1. Access 2007 to Access 2010 Problem
    By evalmedi in forum Access
    Replies: 1
    Last Post: 10-24-2010, 02:56 PM
  2. Replies: 6
    Last Post: 12-01-2009, 11:59 AM
  3. Replies: 0
    Last Post: 11-17-2009, 02:35 PM
  4. Replies: 32
    Last Post: 09-16-2009, 10:06 AM
  5. converting from Access 2003 to Access 2007
    By LawrenceLau in forum Access
    Replies: 6
    Last Post: 11-20-2008, 03:53 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