从电子邮件正文中提取电子邮件地址
Extract an email address from the body of an email
我正在尝试自动回复我们从网站托管服务商处收到的电子邮件。
电子邮件包含发送回复的地址。
如何从电子邮件正文中提取电子邮件地址,并将其插入到新电子邮件的 TO 中?
Outlook 对象模型提供了三种处理项目正文的主要方式:
- Body - 表示 Outlook 项目 clear-text 正文的字符串。
- HTMLBody - 表示指定项目的 HTML 正文的字符串。
- Word editor - 正在显示的消息的 Microsoft Word 文档对象模型。 Inspector class 的 WordEditor 属性 returns 来自 Word 对象模型的 Document class 实例,您可以使用它来设置邮件正文。
您可以在 Chapter 17: Working with Item Bodies 中阅读有关所有这些方式的更多信息。选择哪种方式来处理消息体由我们决定。
要在 Outlook 中设置收件人字段,您可以使用 the corresponding property or use the Recipients collection. The following line of code uses the Add 方法将 'Dan Wilson' 添加为收件人:
Dim myRecipient As Outlook.Recipient
Set myRecipient = mailItem.Recipients.Add("Dan Wilson")
最后,您可能会发现 Getting Started with VBA in Outlook 2010 文章很有帮助。
我正在尝试自动回复我们从网站托管服务商处收到的电子邮件。
电子邮件包含发送回复的地址。
如何从电子邮件正文中提取电子邮件地址,并将其插入到新电子邮件的 TO 中?
Outlook 对象模型提供了三种处理项目正文的主要方式:
- Body - 表示 Outlook 项目 clear-text 正文的字符串。
- HTMLBody - 表示指定项目的 HTML 正文的字符串。
- Word editor - 正在显示的消息的 Microsoft Word 文档对象模型。 Inspector class 的 WordEditor 属性 returns 来自 Word 对象模型的 Document class 实例,您可以使用它来设置邮件正文。
您可以在 Chapter 17: Working with Item Bodies 中阅读有关所有这些方式的更多信息。选择哪种方式来处理消息体由我们决定。
要在 Outlook 中设置收件人字段,您可以使用 the corresponding property or use the Recipients collection. The following line of code uses the Add 方法将 'Dan Wilson' 添加为收件人:
Dim myRecipient As Outlook.Recipient
Set myRecipient = mailItem.Recipients.Add("Dan Wilson")
最后,您可能会发现 Getting Started with VBA in Outlook 2010 文章很有帮助。