如何使用 MAPI 发送邮件?
我想使用用户 Windows 计算机上的邮件客户端发送电子邮件。据我从网上得知,MAPI 是可行的方法。然而,在阅读MSDN文档后,我发现MAPI相当庞大,没有源代码示例。而且我不需要99%的功能,我只想发送一封电子邮件。我该怎么做?
我在 SO 和网络上找到了示例,但它们似乎依赖于一种称为 Simple MAPI 的东西,微软显然已将其列为过时的:“不鼓励使用 Simple MAPI。它可能会在后续版本中更改或不可用视窗”。所以我不想使用这些功能。
我找到了一个很好的例子这里 ,但不幸的是它是针对 Windows CE 的,与 Win32 API 不完全兼容。我设法从该链接实现代码,直到它到达尝试打开草稿文件夹的位置,GetProps 的参数不兼容。有谁知道在哪里可以找到类似的 PC 代码示例? C++ 优先。
I want to send an e-mail using the mail client on the user's Windows computer. As far as I can tell from the net, MAPI is the way to go. However, after reading through the MSDN documentation, I find out that MAPI is quite vast, with no source code examples. And I have no need for 99% of the features, I just want to send an e-mail. How do I do this?
I have found examples here on SO and on the web, but they seem to rely on something called Simple MAPI, which Microsoft has apparently listed as obsolete: "The use of Simple MAPI is discouraged. It may be altered or unavailable in subsequent versions of Windows". So I don't want to use those functions.
I found a very good example here, but unfortunately it is for Windows CE and isn't fully compatible with the Win32 API. I managed to implement the code from that link until it got to where it attempts to open the drafts folder, the parameters to GetProps aren't compatible. Does anyone know where I can find a similar code example for PC? C++ prefered.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在各种互联网资源的帮助下,我自己解决了这个问题。
官方 MSDN 文档
MAPIEx:扩展 MAPI 包装器
记录下来,我会尝试将其发布在这里以供将来参考。
I have solved this by my own, with the help from various internet sources.
Official MSDN documentation
MAPIEx: Extended MAPI Wrapper
Once the code is properly tested & documented, I will try to post it here for future reference.
请参阅使用 MAPI - COM DLL 发送电子邮件
[编辑]
我使用过 MAPI一次,我将发布代码。我不确定这是否是您要找的。这会发送一条带有可选附加文件的消息(但没有正文)。
标题:
CPP:
See Sending Email using MAPI - A COM DLL
[Edit]
I've used MAPI once and I'll post the code. I'm not sure if it's what you're looking for. This sends a message with optionally attached files ( but no body ).
Header:
Cpp: