I need to programmatically open outlook 2016 on a user's computer, with a new message that contains predefined fields (To, Bcc, UTF-8 body, attachment). To do this, I need to generate either a file that opens as a new message, or a script, which makes Outlook open a new message.
This may seem like an easy task, but it's really difficult. For example, I would make it so that I generate a .eml file with the following contents:
From: info@m.net
To: to@m.net
Cc: cc@m.net
Bcc: bcc@m.net
X-Unsent: 1
Subject: Something
This is a test message.
Multipart can be used to add attachment.
The problem is that this will not work, because if such a file is opened outlook (such as an .eml file), Outlook may open it, but it completely ignores the Bcc line.
So, in another iteration, I would try to make a VBS script instead:
Set objoutlookApp = CreateObject("Outlook.Application")
Set objmessage = objoutlookApp.CreateItem(olMailItem)
objmessage.TO = "mail1@domain.com;mail2@example.de"
objmessage.CC = "cc1@x.com;cc2@y.de"
objmessage.BCC = "bcc@domain.com"
objmessage.Subject = "E-Mail Subject"
objmessage.Body = "Here comes some text"
objmessage.display
set objmessage = Nothing
set objoutlookApp = Nothing
wscript.quit
, . , VBS UTF-8, , , UTF-8 , . , -, , atachments (multipart) .
Outlook ( Bcc), , , ?