在用户不知情的情况下发送带有Outlook的电子邮件 [英] Sending an Email with outlook with out user knowing

查看:80
本文介绍了在用户不知情的情况下发送带有Outlook的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种通过c#通过Outlook.interop发送电子邮件而没有任何弹出窗口或安全警告的方法.我正在使用此代码来获取受信任的应用程序对象 https://msdn.microsoft.com/en-us/library/office/ff869819.aspx ...

I am looking for a way to send an email in c# through outlook.interop without any popups or security warnings. I am using this code to get a trusted application object https://msdn.microsoft.com/en-us/library/office/ff869819.aspx ...

private void EmailMessage(string recipient, string subject, string body)
    {
        Microsoft.Office.Interop.Outlook.Application application = GetApplication();
        Microsoft.Office.Interop.Outlook.MailItem email = (Outlook.MailItem)application.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);

        try
        {
            email.Subject = subject;
            email.Body = body;
            email.To = recipient;
            ((Outlook._MailItem)email).Send();
            _emailConfirmation = true;
        }

        catch (System.Runtime.InteropServices.COMException ex)
        {                
            _emailConfirmation = false;
        }
        catch (Exception ex)
        {             
            _emailConfirmation = false;
        }
        finally
        {
            //release the objects used to send email after message has been sent\\
            if (email != null)
                System.Runtime.InteropServices.Marshal.ReleaseComObject(email);
            if (application != null)
                System.Runtime.InteropServices.Marshal.ReleaseComObject(application);
        }
    }

此代码用于发送电子邮件,但是由于Outlook安全管理器的缘故,它仍会提示用户.有什么解决办法,以使用户不会与Outlook发生任何干扰或交互?

And this code to send the email, however it is still prompts the user because of the outlook security manager. Any ideas for a fix so that the user won't have any interruption or interaction with outlook?

推荐答案

请参见 http://www.outlookcode.com/article.aspx?id=52 查看选项列表.基本上可以.

See http://www.outlookcode.com/article.aspx?id=52 for the list of your options. Essentially you can.

  1. 在具有最新防病毒实用程序的计算机上运行代码.Outlook将不会显示安全提示.
  2. 使用扩展MAPI(仅C ++或Delphi)或扩展MAPI包装器,例如兑换包含扩展MAPI并可以从任何语言进行访问.
  1. Run your code on a machine with an up-top-date antivirus utility. Outlook will not display security prompts.
  2. Use Extended MAPI (C++ or Delphi only) or an Extended MAPI wrapper such as Redemption that wraps Extended MAPI and is accessible from any language.

这篇关于在用户不知情的情况下发送带有Outlook的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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