从以管理员身份运行的程序发送电子邮件 [英] Sending email from a program running as Administrator

查看:96
本文介绍了从以管理员身份运行的程序发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我们使用了第三方安全软件包,因此我的应用需要以管理员身份运行.但是,它还需要能够发送电子邮件.

目前,我正在使用MAPISendMail,并且使用Admin特权登录后可以正常工作.问题是,如果登录到普通用户帐户并且PC上的Admin帐户未安装电子邮件客户端(对我们的用户来说是非常可能的话),它将失败.

是否有某种方法可以使用启动它的非管理员用户的帐户来运行MAPISendMail?我知道我可以尝试让我的程序充当其自己的SMTP服务器,但是此应用程序将在我确定会阻止这种方式的公司防火墙后面运行.

我已经在网上闲逛了几个小时,却找不到任何与我的情况有关的东西.任何人都可以提供任何指导吗?

谢谢...汤姆
-----------------------------------
戴夫-正如我指出的那样,我担心的是企业防火墙将阻止我的程序充当邮件服务器,并且试图让其IT部门允许例外可能是一个泥潭.因此,使用现有的(经过IT批准的)电子邮件客户端似乎更容易.我还将承认这种方法消除了我的程序对请求和存储邮件服务器名称,端口等信息的需求,而我宁愿留给其他做得很好的程序.

也许我只需要硬着头皮,将我的程序转换为邮件服务器,并让用户在遇到问题时与他们的IT人员打交道?不过,它对客户不太友好.

Due to the 3rd-party security package we use, my app needs to run as Admin. However, it also needs to be able to send emails.

Currently, I''m using MAPISendMail, and it works as desired when logged in with Admin privileges. The issue is that, if logged into a normal User account and the Admin account on the PC doesn''t have an email client installed (a very real possibility for our users), it fails.

Is there some way to get the MAPISendMail to run using the account of the non-Admin user who started it? I know I could try to have my program act as its own SMTP server, but this application will be running behind corporate firewalls that I''m certain would block that avenue.

I''ve been poking around online for several hours now and haven''t been able to find anything pertinent to my situation. Can anyone here provide any guidance?

Thanks...Tom
-----------------------------------
Dave - as I noted, my concern is that corporate firewalls will block my program from acting as a mail server, and trying to get their IT departments to allow an exception can be a quagmire. So it seems easier to use the existing (IT-approved) email client. I''ll also admit that this approach eliminates the need for my program to request and store mailserver name, port, etc. info, which I''d prefer to leave to other programs that do that very well.

Maybe I just need to bite the bullet, turn my program into a mail server, and let users deal with their IT people if they have problems? Not very customer-friendly though.

推荐答案



您可以将app.manifest文件中的requestedExecutionLevel 更改为
requireAdministrator ,但用户必须接受来自UAC的对话框

Hi,

you can change requestedExecutionLevel in your app.manifest file to
requireAdministrator , but users have to accept dialog from UAC

<requestedexecutionlevel level="requireAdministrator" uiaccess="false" />



它对您有用吗?

问候



Does it work for you?

Regards


在.NET Framework中内置SMTP客户端的情况下,为什么要使用MAPISendMail?

System.Net.Mail [
Why are you using MAPISendMail when there is a SMTP client build into the .NET Framework??

System.Net.Mail[^] namespace


这篇关于从以管理员身份运行的程序发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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