读书人

JMail收发邮件错误

发布时间: 2012-08-24 10:00:21 作者: rapoo

JMail收发邮件异常?
最近要做个邮件自动处理系统,从网上下载了JMail4.5的组件。
用它自带的Visual C++例子程序,执行一直报异常 E_UNEXPECTED.
不知道是什么原因。我的环境是VS2008,XP。

C/C++ code
/***************************************************                                               **   Produced by Dimac                           **                                               **   More examples can be found at               **   http://tech.dimac.net                       **                                               **   Support is available at our helpdesk        **   http://support.dimac.net                    **                                               **   Our main website is located at              **   http://www.dimac.net                        **                                               ***************************************************/// Example of using JMail from C++ using ATL.// The JMail.tlb file is required for this example.    #include "stdafx.h"    #include <iostream>    #import "..\..\jmail.dll" // The path to the jmail.dll file here!// The strings later used as parameters to JMail// And of course they should be edited before building this project.    const char *sender                = "me@mydomain.com";                     // Edit this!!    const char *recipient            = "recipient@hisdomain.com";             // Edit this!!    const char *subject                = "Hello JMail!";    const char *body                = "This message was sent with JMail version 4.0\n"                                       "using the JMailCppEx example!\n";    const char *mailserver        = "mymailserver.mydomain.com";               // Edit this!!    int main(int argc, char* *argv)    {        CoInitialize(NULL);        {            try            {                // jmail::ISpeedMailerPtr is generated and declared by the #import directive.                jmail::ISpeedMailerPtr spJMail("JMail.SpeedMailer");                // Ok, send the mail.                spJMail->SendMail( sender, recipient, subject, body, mailserver );            }            catch( _com_error & E)            {                int a = 1;            }        }        CoUninitialize();        return 0;    }


[解决办法]
直接给support提交问题 http://support.dimac.net
[解决办法]
只用过SMTP和POP3协议收发邮件,没用过JMail
[解决办法]
自己用POP3协议实现发送
[解决办法]
还要测试你的邮件服务器是不是一定要登录了才能发送邮件(即认证后才能发!
[解决办法]
做过一个小的邮件客户端,用的是smtp协议,对于有些类型的邮箱就跟大姨妈来了一样,总有那么一段时间罢工,一个126的邮箱,有天测试的时候发现文本能发送,只要发送附件和图片,最后一道指令响应就不正确,隔了一天又正确了。
[解决办法]
探讨
还有几个搞不明白,有几个邮箱怎么发送都是失败。
比如给一个QQ邮箱,发送都成功的,可是给另一个QQ邮箱,怎么发送都是失败的。

[解决办法]
1楼是来砸场子的,呵呵。
关注!

读书人网 >VC/MFC

热点推荐