如何检查电子邮件是已发送或接收的草稿? (OpenEdge 11)
我正在尝试创建一种方法来检查给定的电子邮件(来自Outlook本身或MSG文件)是发送,已接收还是草稿电子邮件。我可以比较它是否是在其他地方发送或收到的,而且效果很好,但这是确定是否是草稿的部分。以下是我目前拥有的。
L-EMAIL = Aspose.Email.Mapi.MapiMessage:FromFile(P-FILENAME).
L-EMAIL-FLAG = Integer(L-EMAIL:Properties[Aspose.Email.Mapi.MapiPropertyTag:PR_MESSAGE_FLAGS]:ToString()).
IF L-EMAIL-FLAG = 8 THEN
L-EMAIL-STATUS = "DRAFT".
ELSE
IF L-EMAIL:Properties[Aspose.Email.Mapi.MapiPropertyTag:PR_RECEIVED_BY_ENTRYID] = ? THEN
L-EMAIL-STATUS = "SENT".
ELSE
L-EMAIL-STATUS = "RECEIVED".
如果电子邮件没有附件,它可以正常工作,因为草稿的价值总是8个,但是一旦添加附件,它就会变得很奇怪,因此我无法降低范围诸如24和242613之类的值时,带有附件的发送电子邮件的值为49)。任何人都知道一种更聪明的方法来告诉它是否是草稿吗?
I'm trying to create a way to check whether a given email (either from Outlook itself or an MSG file) is a sent, received or a draft email. I got the bit to compare if it was sent or received somewhere else and that works fine but it's the part that determines if it's a draft or not that is the issue. Below is what I have currently.
L-EMAIL = Aspose.Email.Mapi.MapiMessage:FromFile(P-FILENAME).
L-EMAIL-FLAG = Integer(L-EMAIL:Properties[Aspose.Email.Mapi.MapiPropertyTag:PR_MESSAGE_FLAGS]:ToString()).
IF L-EMAIL-FLAG = 8 THEN
L-EMAIL-STATUS = "DRAFT".
ELSE
IF L-EMAIL:Properties[Aspose.Email.Mapi.MapiPropertyTag:PR_RECEIVED_BY_ENTRYID] = ? THEN
L-EMAIL-STATUS = "SENT".
ELSE
L-EMAIL-STATUS = "RECEIVED".
If there's no attachments to the emails, it works fine since the value of a draft email is always 8 but as soon as you add attachments, it gets all weird with the values so I can't get a range down (I've gotten values like 24 and 242613 while a sent email with an attachment has a value of 49). Anyone know a smarter way of telling if it's a draft or not?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我从来没有与Outlook和内部进步一起工作的良好经验...我在项目上完成的工作是与C#创建自定义DLL并将其集成到我的系统中。
因此,我有一个char,可以触发我的DLL中的某些过程,并发送和接收电子邮件(保存为.msg),从而使我的进度代码更容易管理。
就您而言,您应该尝试这样的事情:
Outlook MailItem:如何区分邮件是否正在启动或外向?
I never had a good experience working with Outlook and Progress internally... what I've managed to accomplish on my project was to create a custom DLL with C# and integrated it on my system.
So, I have an char that triggers some procedures inside my DLL and sends and receives emails (saves as .msg), making my Progress code a lot more easier to manage.
In your case, you should try something like this:
Outlook MailItem: How to distinguish whether mail is incoming or outgoing?
我发现的解决方案是使用
c#
DLL使用Interop将电子邮件转换为Outlook Mail项目:我必须发布电子邮件对象,以便进一步的代码不会破坏。
Solution I found was to use a
C#
DLL to convert the email to an Outlook mail item using the interop:I had to release the email object so that code further on wouldn't break.
请用以下代码替换上线。希望这对您有帮助。
我与Aspose一起担任开发人员传教士。
The PidTagMessageFlags property value is a bitmask of flags. This means a bitwise operator must be applied to check a specific flag value.
Please replace above line with following line of code. Hope this helps you.
I work with Aspose as Developer Evangelist.