在Outlook加载项中以MIME格式保存邮件(* .eml) [英] Save Mail in MIME format (*.eml) in Outlook Add-In

查看:1712
本文介绍了在Outlook加载项中以MIME格式保存邮件(* .eml)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个Outlook Addin(C#),它将选定的邮件(MailItem)以纯MIME格式(.eml)保存到磁盘。
MailItem.SaveAs()方法仅允许以.msg格式保存。
有没有其他(简单)的方法,以eml格式保存邮件?我想保留原始邮件的所有细节。



我已经阅读了有关Outlook WebServices的内容。也许我可以在交换服务器上搜索当前在Outlook中选择的邮件,并从交换中再次接收它,并保存为.eml?这个选项需要什么?



是否可以以简单的方式将保存的.msg转换为.eml(保留所有详细信息,标题等) ?



我希望有人可以帮助我解决这个问题,因为我花了几个小时搜索解决方案,没有任何结果。

解决方案

您可以



1)一次在您的代码中显式创建MIME文件一个属性。您也可以使用现有的MIME转换器(我过去使用过Lumisoft) - 但是它们不会在单个调用中转换Outlook消息;您将需要说明构建所有标题和MIME部分。



2)使用 IConverterSession 对象(仅限C ++或Delphi) - 这是Outlook使用的相同的MIME转换器。您可以在 OutlookSpy (点击IConverterSession按钮)中播放它。以下脚本(VBS)将在Outlook中将当前选中的邮件保存为EML文件



3)使用赎回及其 RDOMail .SaveAs或 SafeMailItem .SaveAs方法 - 它可以保存为MIME格式(olRfc822)以及一个十几个其他格式。它使用 ICONVERTERSession 对象可用(Outlook 2003及更高版本)或其旧版本的Outlook的自己的转换器或用于Exchange版本的MAPI。

  set Session = CreateObject(Redemption.RDOSession)
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set rItem = Session.GetMessageFromID(Application.ActiveExplorer.Selection(1).EntryID)
rItem.SaveAsc:\temp\test.eml,1024


I want to write a little Outlook addin (C#), which saves a selected mail (MailItem) to disk in plain MIME format (.eml). The MailItem.SaveAs() method only allows to save in .msg format. Is there any other (simple) way, to save the mail in eml-format? I want to keep all details of the original mail.

I've read something about the Outlook WebServices. Maybe I can search the exchange server for the currently in outlook selected mail and receive it again from exchange and save it as .eml? What will I need for this option?

Is it possible to convert a saved .msg to .eml in an easy way (with keeping all details, headers and so on)?

I hope someone can help me with this problem, because I have spent a couple of hours on searching for a solution without any result.

解决方案

You can either

1) Create MIME file explicitly in your code one property at a time. You can also use existing MIME converters (I used Lumisoft in the past) - but they won't convert Outlook messages in a single call; you will need to expliiclty build all the headers and MIME parts.

2) Use IConverterSession object (C++ or Delphi only) - this is the same MIME converter used by Outlook. You can play with it in OutlookSpy (click IConverterSession button). The following script (VBS) will save the currently selected message in Outlook as an EML file

3) Use Redemption and its RDOMail.SaveAs or SafeMailItem.SaveAs methods - it can save in the MIME format (olRfc822) along with a dozen or so other formats. It uses IConverterSession object when it is available (Outlook 2003 and up) or its own converter for an older version of Outlook or when used against the Exchange version of MAPI.

  set Session = CreateObject("Redemption.RDOSession")
  Session.MAPIOBJECT = Application.Session.MAPIOBJECT
  set rItem = Session.GetMessageFromID(Application.ActiveExplorer.Selection(1).EntryID)
  rItem.SaveAs "c:\temp\test.eml", 1024

这篇关于在Outlook加载项中以MIME格式保存邮件(* .eml)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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