生成文件以使用“密件抄送”字段打开Outlook新邮件 [英] Generate file to open Outlook new message with Bcc field

查看:208
本文介绍了生成文件以使用“密件抄送”字段打开Outlook新邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在用户计算机上以编程方式打开展望2016,新消息包含预定义字段(To,Bcc,UTF-8正文,附件)。为此,我需要生成一个outlook打开的文件作为一个新消息,或一个脚本,使outlook打开新消息。

I need to programatically open outlook 2016 on users computer, with new message, which contains the predefined fields (To, Bcc, UTF-8 body, attachment). For that, I need to generate either a file which outlook opens as a new message, or a script which makes outlook open the new message.

它可能看起来像一个容易任务,但实际上是棘手的。例如,我会以这样一种方式来生成.eml文件,内容如下:

It may look like an easy task, but it is actually tricky. I would, for example, do it in a way that I generate an .eml file, with content like this:

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.

问题是这不行,因为如果这样的文件被outlook打开(as。 eml文件),outlook可以打开它,但它完全忽略了Bcc行。

The problem is that this won't work, because if such file is opened by outlook (as .eml file), outlook is able to open it, but it ignores Bcc line entirely.

所以在另一个迭代中,我会尝试使用VBS脚本: p>

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)。

This seems a bit better, but is still insufficient. First of all, the VBS file cannot be in UTF-8 format, thus it's not possible to send an email in chinese, for example, I need to be able to write UTF-8 encoded string directly to the body since it needs to be a single-file solution. And second, I have no idea how to add atachments (multipart) this way.

有没有办法在Outlook中打开新的消息窗口,包含预定义字段(包括密送) ,一个文件,我可以生成服务器端,然后发送给用户打开?

Is there any way to open new message window in outlook with predefined fields (including Bcc), by a file which I can generate server side and then send to the user to open?

推荐答案

您的VBS文件不能是UTF -8编码,但VB脚本工作正常与UTF-16编码文件。我从记事本以UTF-16编码保存的以下文件没有问题:

Your VBS file cannot be UTF-8 encoded, but VB script works just fine with UTF-16 encoded files. I had no problem with the following file saved in UTF-16 encoding from Notepad:

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名 <bcc@domain.com>"
objmessage.Subject = "E-Mail Subject"
objmessage.Body = "Here comes some text"
objmessage.display
set objmessage = Nothing
set objoutlookApp = Nothing

这篇关于生成文件以使用“密件抄送”字段打开Outlook新邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆