生成文件以使用“密件抄送”字段打开Outlook新邮件

编程入门 行业动态 更新时间:2024-10-09 16:22:52
本文介绍了生成文件以使用“密件抄送”字段打开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 To: to@m Cc: cc@m Bcc: bcc@m 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;mail2@example.de" objmessage.CC = "cc1@x;cc2@y.de" objmessage.BCC = "bcc@domain" 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;mail2@example.de" objmessage.CC = "cc1@x;cc2@y.de" objmessage.BCC = "有些BCC名 <bcc@domain>" objmessage.Subject = "E-Mail Subject" objmessage.Body = "Here comes some text" objmessage.display set objmessage = Nothing set objoutlookApp = Nothing

更多推荐

生成文件以使用“密件抄送”字段打开Outlook新邮件

本文发布于:2023-05-31 13:58:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/393000.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:密件   字段   新邮件   文件   Outlook

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!