使用“兑换”回复邮件只能间歇性地设置正文

发布于 2024-08-21 16:14:59 字数 1104 浏览 6 评论 0原文

我使用以下方法回复进入业务功能邮箱的邮件。

所添加的正文只是间歇性地设置。仅当有人发送电子邮件取消订阅邮件,但在数据库中未找到发件人(或正文)的电子邮件地址,并且我们希望他们向我们发送他们想要的邮件地址时,才会调用此方法取消订阅。

private void replyToMail(OutlookItem item)
        {
            RDOSession session = new RDOSession();
            session.Logon(null, null, null, true, null, null);
            RDOMail thisItem = session.GetMessageFromID(item.EntryID, item.StoreID, null);
            RDOMail reply = thisItem.Reply();

            RDOAddressEntry optingout = session.AddressBook.GAL.ResolveName("optingout");
            //reply.Sender = optingout; this had no effect
            reply.SentOnBehalfOf = optingout;
            reply.Subject = "Automated Response - Could not complete unsubscribe";
            reply.Body = "This is an automated response from the Newsletter unsubscribe system. We couldn't find "+item.Sender+" in our database to unsubscribe you from our mailings.\r\n\r\nPlease reply to this mail and include the email address you want to unsubscribe.\r\n\r\nKind Regards\r\n.";
            reply.Send();

            session.Logoff();
        }

I'm using the below method to reply to mails coming in to a business function mailbox.

The body text being added is only intermittently being set. This method is only called when someone has emailed in to unsubscribe from a mailing but the email address of the sender (or in the body) hasn't been found in the database and we want to ask them to send us the mail address they want to unsubscribe.

private void replyToMail(OutlookItem item)
        {
            RDOSession session = new RDOSession();
            session.Logon(null, null, null, true, null, null);
            RDOMail thisItem = session.GetMessageFromID(item.EntryID, item.StoreID, null);
            RDOMail reply = thisItem.Reply();

            RDOAddressEntry optingout = session.AddressBook.GAL.ResolveName("optingout");
            //reply.Sender = optingout; this had no effect
            reply.SentOnBehalfOf = optingout;
            reply.Subject = "Automated Response - Could not complete unsubscribe";
            reply.Body = "This is an automated response from the Newsletter unsubscribe system. We couldn't find "+item.Sender+" in our database to unsubscribe you from our mailings.\r\n\r\nPlease reply to this mail and include the email address you want to unsubscribe.\r\n\r\nKind Regards\r\n.";
            reply.Send();

            session.Logoff();
        }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

祁梦 2024-08-28 16:14:59

首先,如果您已经使用 OOM,则没有理由调用 RDOSession.Logon。您可以简单地设置 MAPIOBJECT 属性:
将 session.Logon() 行替换为
session.MAPIOBJECT = item.Application.Session.MAPIOBJECT
不要调用注销。

其次,你的意思是消息是在没有正文的情况下收到的吗?您在“已发送邮件”文件夹中看到空的邮件吗?

Firstly, if you are already usign OOM, there is no reason to call RDOSession.Logon. You can simply ste the MAPIOBJECT property:
Replace the line session.Logon() with
session.MAPIOBJECT = item.Application.Session.MAPIOBJECT
do not call Logoff.

Secondly, do yo umean the message is received with out a body? Do you see teh empty bofy in the Sent Items folder?

弥繁 2024-08-28 16:14:59

我必须编辑 thingie.HTMLBody 以及 thingie.Body。

我想我可以弄清楚如何判断何时设置每个值,但由于我只是想确保在这种情况下我可以控制身体,所以我只是设置两者。

I had to edit thingie.HTMLBody as well as thingie.Body.

I suppose I could have figured out how to tell when to set the value of each one but since I just want to be sure that I have control of the body in this instance I'm simply setting both.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文