首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

用dll发邮件,该如何处理

2012-01-23 
用dll发邮件// Example of using JMail from C++ using ATL.// The JMail.tlb file is required for this

用dll发邮件
// Example of using JMail from C++ using ATL.
// The JMail.tlb file is required for this example.
#include <iostream.h>
#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= "xxxxx@qq.com"; // Edit this!!
const char *recipient= "xxxxxx@163.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= "xxxx_xxxx:xxxxxxxxx@smtp.xxx.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)
{
cerr
<< "Error: 0x" << hex << E.Error() << endl
<< E.ErrorMessage() << endl;

}

}

CoUninitialize();

return 0;
}
刚学com,这个程序的变量定义不是很懂,请大家给解释解释。

[解决办法]
spJMail可能是JMail.SpeedMailer对象的指针
[解决办法]
这个在这里问。。。去c\c++看看吧

热点排行