Results 1 to 2 of 2
  1. #1
    prstoessel is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jul 2011
    Posts
    18

    Email from Access 2003 with SMTP authentication

    Hello,



    The following script has worked fine for us until our ISP changed our outgoing mail server to one that requires authentication. Can someone please assist me in updating the following code so it will authenticate on the outgoing mail server?

    Code:
    Sub Send_Mail_Messages_With_SMTP()
    On Error GoTo Error_Handler
    Const cdoBasic = 1 'basic (clear-text) authentication
    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 cdoNTLM = 2 'NTLM
    Dim item As Integer
    Dim attlist As String
    Dim iMsg
    Dim iConf
    Dim Flds
    Dim strHTML
    Dim strAttachment2
    Dim stBody1 As String, stBody2 As String, stSubject As String
    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.configuration")
    Set Flds = iConf.Fields
    'Set lfsFile1 = CreateObject("Scripting.FileSystemObject")
    With Flds
    .item("http://schemas.microsoft.com/cdo/con...tion/sendusing") = 2 'cdoSendUsingPort
    .item("http://schemas.microsoft.com/cdo/con...smtpserverport") = 25
     
    'Configuration for IX Webhosting without Authentication:
    .item("http://schemas.microsoft.com/cdo/con...ion/smtpserver") = "mail.sthealthgroup.com"
     
    'Server timeout set to 300 seconds due to current issues with SMTP connect delay with IX Webhosting as of 2/20/2008
    .item("http://schemas.microsoft.com/cdo/con...nectiontimeout") = 300
     
    .Update
    End With
     
    With iMsg
    Set .Configuration = iConf
    .To = Send_To_Email_Address
    .cc = CC_Email_Address
    .bcc = BCC_Email_Address
    .from = Sent_From_Email_Address
    .ReplyTo = "HMAH_CCR@sthealthgroup.com;" & Sent_From_Email_Address & ";" & CC_Email_Address
    .Subject = Subject_Line
    '.TextBody = EMailBodyText
    .HTMLBody = HTMLBodyText
     
    [Form_EMAIL_DISTRIB].txtSource_Location.SetFocus
    For Counter = 1 To TempCounter
    .AddAttachment [Form_EMAIL_DISTRIB].txtSource_Location.Text & CurrentHospital & Attachment_Name(Counter)
    Next Counter
    .Send
     
    End With
     
    Set iMsg = Nothing
    Set iConf = Nothing
    Set Flds = Nothing
    Exit Sub
     
    Error_Handler:
    MsgBox Err.Number & " " & Err.Description
    Resume Next
    End Sub

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    it'll take a miracle to find someone here that will just KNOW the coding needed. CDO is not a widely-discussed method. More than likely because it requires a higher-level of competency to understand + it works. From what I've experienced, anyway.

    doing this:

    http://www.google.com/#hl=en&sugexp=...bc058ba87a7947

    is the obvious solution. and apparently there's quite a lot of info there.

    the other "obvious" here is that you need to ask a competent person at your ISP about any additional information that is needed requiring the authentication. more than likely, none. But then again, nothing is ever simple.

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

Similar Threads

  1. Password Authentication
    By jmjbear in forum Programming
    Replies: 8
    Last Post: 11-27-2011, 02:12 PM
  2. import excel file to access 2003 yes, access 2007 no
    By stapik in forum Import/Export Data
    Replies: 9
    Last Post: 07-27-2011, 07:09 AM
  3. Replies: 4
    Last Post: 04-13-2011, 10:11 AM
  4. Windows 7 and smtp mail with Access 2003
    By mafhobb in forum Programming
    Replies: 1
    Last Post: 06-28-2010, 09:05 AM
  5. Replies: 1
    Last Post: 09-06-2006, 11:48 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