I have some code which sends an email through VBScript:
What I would like to do is to place a copy of this email in the 'Sent Items' Mailbox for the specified user in the script (e.g. sendusername). Is it possible to connect to Exchange somehow and do this? Thank you...
Code:
'create the email components, attach the zip file etc and send
strSchema = "[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/"[/URL]
Set objConfig= CreateObject( "CDO.Configuration" )
With objConfig
.Fields.Item( strSchema & "smtpserver" ) = strEmailServer
.Fields.Item( strSchema & "smtpserverport" ) = 25
.Fields.Item( strSchema & "smtpconnectiontimeout" ) = 10
.Fields.Item( strSchema & "smtpauthenticate" ) = 1
.Fields.Item( strSchema & "sendusing" ) = 2
.Fields.Item( strSchema & "sendusername" ) = strEmailUsername
.Fields.Item( strSchema & "sendpassword" ) = strEmailPassword
.Fields.Update
End With
Set objMessage = CreateObject( "CDO.Message" )
With objMessage
.Configuration = objConfig
.From = strEmailFrom
.To = strEmailToAddress
.Subject = strEmailSubject
.HTMLBody = strTextBody
.AddAttachment strZipDest
.Fields("urn:schemas:mailheader:disposition-notification-to") = StrEmailResponse
.Fields("urn:schemas:mailheader:return-receipt-to") = StrEmailResponse
.DSNOptions = 14
.Send
End With
Set objMessage = Nothing
Set objConfig = Nothing