I've got some code that sends emails from a specific user account in Exchange where the user doesn't need to have Outlook open. However, I also need to send a calendar invite using information from fields in my form
Can anyone help with using similar but calling the calendar function to send the message as a calendar invite?
Any help is greatly appreciated.
Many thanks
Can anyone help with using similar but calling the calendar function to send the message as a calendar invite?
Any help is greatly appreciated.
Many thanks
Code:
Public Function SendMail(strEmailTo As String, strSubject As String, strBody As String)
Dim strMailServer As String
Dim strMailUser As String
Dim strMailPass As String
Dim strMailFrom As String
strMailServer = DLookup("MailServerAddress", "tblSettings")
strMailUser = DLookup("MailServerUser", "tblSettings")
strMailPass = DLookup("MailServerPass", "tblSettings")
strMailFrom = DLookup("MailServerFrom", "tblSettings")
Dim mail As CDO.Message
Dim config As CDO.Configuration
Set mail = CreateObject("CDO.Message")
Set config = CreateObject("CDO.Configuration")
config.Fields(cdoSMTPAuthenticate).Value = cdoNTLM
config.Fields(cdoSendUserName).Value = strMailUser
config.Fields(cdoSendPassword).Value = strMailPass
config.Fields(cdoSendUsingMethod).Value = cdoSendUsingPort
config.Fields(cdoSMTPServer).Value = strMailServer
config.Fields(cdoSMTPServerPort).Value = 25
config.Fields.Update
Set mail.Configuration = config
With mail
.To = strEmailTo
.From = strMailFrom
.Subject = strSubject
.TextBody = strBody
.Send
End With
Set config = Nothing
Set mail = Nothing
End Function