发送前用ID号标记Outlook MailItem,而不会导致TNEF(RTF)发送 [英] Tag Outlook MailItem with ID number before send without causing TNEF (RTF) send

查看:142
本文介绍了发送前用ID号标记Outlook MailItem,而不会导致TNEF(RTF)发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Outlook加载项,用于在MailItem发送之前将UserProperty分配给MailItem:

I have an Outlook add-in which assigns a UserProperty to a MailItem before it is sent:

Outlook.UserProperty prop = mail.UserProperties.Add("XXXX", Outlook.OlUserPropertyType.olText);
prop.Value = "YYYY";

众所周知(请参阅停止Outlook将HTML转换为RTF 例如),这样做会导致使用TNEF(即RTF格式,可怕的winmail.dat)发送电子邮件.

It is known (see Stop Outlook from converting HTML to RTF for example) that doing this causes the email to be sent using TNEF (ie RTF format, the dreaded winmail.dat).

我的问题是,简单地取消设置TNEF属性是否安全?下面的代码可以做到这一点:

My question is, is it safe to simply un-set the TNEF property? The following code will do that:

mail.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8582000B", false);

这里的问题是我必须在ItemSend上执行此操作-设置属性后我无法立即执行此操作,因为此时无论如何它总是false.当我按下发送"时,它只会变成true.

The issue here is that I have to do this on ItemSend - I can't do it straight after I set the property, because it's always false anyway at that point. It only turns true when I hit Send.

我不介意取消设置TNEF属性将意味着该属性不会随电子邮件一起发送.我更担心的是,在某些情况下实际需要TNEF,并且此代码会破坏它们.

I don't mind the fact that un-setting the TNEF property will mean that the property does not get sent with the email. I am more concerned that there may be other situations where TNEF is actually required and that this code would break them.

或者,是否有更好的方法在发送带有自定义ID号的电子邮件之前对其进行标记"?

Or alternatively, is there a better way altogether of "tagging" an email with a custom ID number before it is sent?

推荐答案

请勿使用UserProperties集合标记消息-它会同时更新具有用户属性定义的Blob和存储用户prop值的命名属性. 如果使用MailItem.PropertyAccessor.SetProperty设置后者而不设置前者,则Outlook将不会强制使用TNEF格式.

Do not use UserProperties collection to tag a message - it updates both the blob with the user properties' definition and the named property where the user prop value is stored. If you use MailItem.PropertyAccessor.SetProperty to set the latter without setting the former, Outlook will not force the TNEF format.

除非您以RTF格式发送,否则将UseTnef属性设置为false是安全的-在将其重置为false之前,请检查该属性是否设置为true.

It is safe to set the UseTnef property to false unless you are sending in the RTF format - check if that property is set to true before resetting it to false.

这篇关于发送前用ID号标记Outlook MailItem,而不会导致TNEF(RTF)发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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