Hello all, I have this interesting problem and it has me scratching my head. I have updated a few forms to use CDOSYS to email instead of using the doCmd.SendObjec t.
This is the code that in 3 of 4 forms is working correctly. On the form that isn't sending, I have stepped through the entire procedure, and set a watch on objMessage. Once I pass send, the object correctly has a sent date, but no email comes!
I am using Access 2003, XP Pro.
Does anyone have any thoughts or ideas?
Thanks,
squiggly12
Code:
Dim objMessage As Object
Dim strFromEmail As String
Dim intCaller As Integer
Dim strCallerComments As String
Dim strCallerEmail As String
Dim strCallerPhoneNumber As String
Dim strHTMLBody As String
Dim strDateOfCall As String
Dim strCallerName As String
Dim strAssignedTo As String
strFromEmail = DLookup("[E-Mail Address]", "[CSD Personnel]", "[CSD Name] = '" & txtCallLogBy.Value & "'")
strAssignedTo = DLookup("[CSD Name]", "[CSD Personnel]", "[Initials] = '" & Initials.Value & "'")
intCaller = UserID.Value
strCallerName = DLookup("[UserName]", "[Users2]", "[UserID] = " & intCaller)
strCallerComments = CallerComments.Value
strCallerEmail = DLookup("[E-MailAddress]", "[Users2]", "[UserName] = '" & strCallerName & "'")
strCallerPhoneNumber = DLookup("[PhoneNumber]", "[Users2]", "[UserName] = '" & strCallerName & "'")
strDateOfCall = CallDateTime.Value
strHTMLBody = "<h1>Call Log Email</h1><br><br>" & stSubject & "<br><br>"
strHTMLBody = strHTMLBody & "<b>Assigned To:</b> " & strAssignedTo & "<br><br>"
strHTMLBody = strHTMLBody & "<br><br><b>Caller's Name:</b> " & strCallerName & "<br><br>"
strHTMLBody = strHTMLBody & "<b>Caller's Email:</b> " & strCallerEmail & "<br><br>"
strHTMLBody = strHTMLBody & "<b>Caller's Phone Number:</b> " & Format(strCallerPhoneNumber, "(###) ###-####") & "<br><br>"
strHTMLBody = strHTMLBody & "<b>Reason For Calling:</b> " & strCallerComments & "<br><br>"
strHTMLBody = strHTMLBody & "<b>Date Of Call:</b> " & strDateOfCall
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = stSubject
objMessage.From = strFromEmail
objMessage.To = stSendTo
objMessage.HTMLBody = strHTMLBody
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.truecos.com"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.sEnd
I am using Access 2003, XP Pro.
Does anyone have any thoughts or ideas?
Thanks,
squiggly12
Comment