更改Outlook邮件中的回复地址 [英] Change reply address in Outlook mail

查看:138
本文介绍了更改Outlook邮件中的回复地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Excel工作表,其中包含雇员姓名",电子邮件ID"和"DOB"三列.

I have an Excel sheet with three columns Employee Name, Email ID and DOB.

我编写了一个宏,该宏将员工的出生日期与今天的日期进行匹配,该日期将向员工和我的部门抄送Outlook邮件.

I wrote a macro which matches birth dates of the employees with today's date that will send an Outlook mail To the employee and Cc my department.

当所有员工看到该邮件时,他们可以单击答复或全部答复.

When all the employees see that mail they can click on reply or reply to all.

我写了另一个Outlook宏,将收件人地址"字段替换为他/她的生日人员电子邮件ID.

I wrote another Outlook macro which replaces To address field with his/her birthday person email id.

第二个宏正在我打开的所有Outlook电子邮件上的系统上运行.

The second macro is working on my system on any Outlook email which is open.

因为我有Outlook宏,所以我能够执行它,但是在所有需要此Outlook宏的员工系统中执行相同的操作.我如何在他们的系统中运行它而又不手动将这个宏放入他们的系统中?

Because I have the Outlook macro I am able to execute it but to perform same thing in all the employees systems they need this Outlook macro. How can I run it in their systems without putting this macro in their systems manually?

推荐答案

以下代码假定ObjMail是您正在创建的消息.

The following code assumes ObjMail is the message you are creating.

' Delete any existing reply recipients
Do While ObjMail.ReplyRecipients.Count > 0
  ObjMail.ReplyRecipients.Remove 1
Loop

' Add the new recipient
ObjMail.ReplyRecipients.Add "BirthdayPerson@isp.com"

' Send blind copy to other staff members
ObjMail.BCC = "Staff1.isp.com, Staff2.isp.com, Staff3.isp.com" 

发送给工作人员的消息会说它来自发送生日消息的人.但是,如果有人回复,收件人将是"BirthdayPerson@isp.com".

The message sent to staff will say it has come from whoever sends the birthday messages. But if anyone replies, the recipient will be "BirthdayPerson@isp.com".

我已将盲目副本发送给其他工作人员.这不是因为工作人员名单是秘密的,而是因为:

I have sent blind copies to other staff members. This is not because the staff list is secret but because:

  • 如果您有500名员工,每个地址平均20个字符,那么使用CC将为500条消息中的每条消息添加10,000个字符.
  • 它可以防止工作人员在添加其最良好的祝愿时使用全部答复",从而节省另外500 * 500条消息.
  • 如果您想填充公司的服务器,请使用ObjMail.CC.

我担心消息的大小,因为很多年前,我在英国NHS工作,该公司有成千上万的员工遍布全国.一家小型医院的某人试图在医院内做广告出售自行车,但设法向该国的每位员工做广告.我在家中使用慢速拨号线路工作;下载此消息花了半个小时.

I worry about message size because many years ago I worked for the English NHS which had thousands of employees scattered across the country. Someone at a small hospital tried to advertise his bicycle for sale within the hospital but managed to advertise it to every employee in the country. I worked from home with a slow dial-up line; it took half-an-hour to download this message.

新部分,以响应要求完整的测试例程代码的要求

下面,我提供了用于测试答案的完整例程.它改编自我为另一个答案编写的例程.它创建了您可能不需要的HTML正文,但向您显示了如何执行.我已将我用于测试的真实电子邮件地址替换为虚拟地址;否则,它保持不变.

Below I include the full routine I used to test my answer. It was adapted from a routine I wrote for another answer. It creates an HTML body which you may not want but shows you how if you do. I have replaced the real email addresses I used for my tests with dummy addresses; otherwise it is unchanged.

Sub ReplyToRecipientWithBlindCopies()

  ' Create a mail item with a simple message.
  ' Send the mail item to "BirthdayPerson@isp.com" and make them
  ' the recipient of any replies.
  ' Send blind copies to all other recipients.

  ' Author: Tony Dallimore, York, England

  Dim OlApp As Outlook.Application
  Dim ObjMail As Outlook.MailItem

  Dim MessageBody As String

  ' This creates a blue message on a grey background.  This is a
  ' demonstration of what is possible; not a recommendation!
  MessageBody = "<table width=""100%"" style=""Color:#0000FF;" & _
         " background-color:#F0F0F0;""><tr><td align= ""center"">" & _
         "Happy birthday from all your colleagues!</td></tr></table>"

  Set OlApp = Outlook.Application
  Set ObjMail = OlApp.CreateItem(olMailItem)
  With ObjMail
    .BodyFormat = olFormatHTML
    .Subject = "Happy birthday!"
    .HTMLBody = HeadAndBodyToHtmlDoc("", MessageBody)

    ' Remove any existing recipients
    Do While .Recipients.Count > 0
      .Recipients.Remove 1
    Loop
    ' Remove any existing reply recipients
    Do While .ReplyRecipients.Count > 0
      .ReplyRecipients.Remove 1
    Loop

    ' Add birthday person to Recipient and ReplyRecipient lists
    .Recipients.Add "BirthdayPerson@isp.com"
    .ReplyRecipients.Add "BirthdayPerson@isp.com"

    ' You will need to replace this with a loop
    ' to add all your staff members.
    .BCC = "Staff1@isp.com, Staff2@isp.com, Staff3@isp.com"

    ' Display the prepared messages ready for any final changes.
    ' The user must send it.
    .Display
  End With

End Sub
Function HeadAndBodyToHtmlDoc(Head As String, Body As String) As String

  ' Wrap Head and Body created by caller in a standard envelope.

  ' Author: Tony Dallimore, York, England

  HeadAndBodyToHtmlDoc = _
        "<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Frameset//EN""" & _
        " ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"">" & _
        vbCr & vbLf & "<html xmlns=""http://www.w3.org/1999/xhtml""" & _
        " xml:lang=""en"" lang=""en"">" & vbCr & vbLf & "<head><meta " & _
        "http-equiv=""Content-Type"" content=""text/html; " & _
        "charset=utf-8"" />" & vbCr & vbLf & Head & vbCr & vbLf & _
        "</head><body>" & vbCr & vbLf & Body & "</body></html>"

End Function

这篇关于更改Outlook邮件中的回复地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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