如何在没有弹出对话框的情况下从VC ++以编程方式发送电子邮件? [英] How can I send an e-mail programatically from VC++ without popup dialogs?

查看:72
本文介绍了如何在没有弹出对话框的情况下从VC ++以编程方式发送电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我一直在移植可在Windows 98下运行的旧C ++/MFC程序.
每次发生错误(用户错误)时,程序都会自动向多个帐户发送电子邮件,以使他们能够跟踪问题.

我的开发机器是W7,当我尝试发送电子邮件时,出现一个对话框,要求我进行该操作. Windows 98并没有发生这种情况,这似乎是由于Microsoft已在新操作系统中实施了新的安全措施.

由于此程序中的邮件功能是为了提醒错误行为,因此发送电子邮件不应是可选的,并且不需要用户干预.

在Internet上搜索时,我发现了一个MAPI类(这里是Noel Dillabough的CP),但似乎没有安装Outlook就无法正常工作(在我看来,这不是一个超级问题).但是,除此之外,我还必须保持Outlook处于打开状态,以便即使应用程序在出站框"中获取消息也允许它发送消息. (这是一个大问题).

在尝试了之后,我看到了一个直接用于SMTP的类(同样在CP,但这次是Nish),这个类看起来很完美,但是用ATL编写,因此我无法在MFC应用程序中使用它. ''正在使用,似乎无法添加对ATL的支持(最终失败,返回0x80004005(E_FAIL))...

因此,在这一点上...将如何建议我在不使用以下条件的情况下发送电子邮件:
-需要打开Outlook.
-必须验证弹出对话框.
-安装超越这种安全性的程序.

?

预先感谢您的帮助!

Hello all,

I''ve been porting an old C++/MFC program that worked under windows 98.
Each time something wrong happens (user fault) the program sends automatically an e-mail to several accounts in order to allow them to follow the issue.

My development machine is a W7 and when I try to send an e-mail I get a dialog asking for my permission on that action. This was not happening in windows 98, and seems to be due to the new safety measures that Microsoft has implemented into the new operating systems.

As the mail functionality in this program is to alert of a wrong behavior, sending the e-mail should not be optional and that should not require the user intervention.

Searching in the Internet I''ve found a MAPI class (here at CP from Noel Dillabough) but it seems that without Outlook installed it can''t work (this is not a super problem in my case); but, apart of that I have to keep Outlook open in order to allow it to send the messages even the app gets the messages in the "outbound box". (and this is a big problem).

After trying that I''ve seen a class that worked with SMTP directly (again here at CP but this time from Nish) and that one seemed perfect, but written in ATL and therefore I can''t use it in the MFC app I''m using as it seems that I can''t add support for ATL (it fails at the end returning me a 0x80004005 (E_FAIL))...

So at this point... what would recommend me to be able to send e-mails without:
- Needing Outlook opened.
- Having to validate popup dialogs.
- Installing programs that surpass this kind of security.

?

Thank you in advance for your help!

推荐答案

好吧,

最后,我自己解决了" ...

我从PJ Naughter找到了一个类,该类令人惊奇,并且可以通过SMTP与MFC一起使用,因此问题得以解决.

您可以在此处看到该类: CSMTPConnection v1.36 [ ^ ]. (请查看联系作者",该链接指向存储最新课程的网站).

最终问题解决了. :thumbsup:
Well,

At the end I''ve solved it "by myself"...

I''ve found a class from PJ Naughter that makes wonders and that works with MFC using SMTP, so problem solved.

You can see the class here: CSMTPConnection v1.36[^]. (look at "Contacting the author" where the link to the site where the newest class is stored).

At the end problem solved. :thumbsup:


这篇关于如何在没有弹出对话框的情况下从VC ++以编程方式发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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