基本信息
源码名称:C++ SMTP发送邮件(支持SSL,可用于使用QQ邮箱发送)
源码大小:1.74M
文件格式:.zip
开发语言:C/C++
更新时间:2019-04-26
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
最近想用C 发送邮箱,发现QQ神马的,都需要SSL,而且QQ和126 都需要授权码来在第三方登陆,弄的很复杂,所以就下载了一个类。非常给力,试过你就知道。因为是牛人写的,这个牛人不是我,,,codeproject上的。亲测,win7 ,vs2010 无问题。
最近想用C 发送邮箱,发现QQ神马的,都需要SSL,而且QQ和126 都需要授权码来在第三方登陆,弄的很复杂,所以就下载了一个类。非常给力,试过你就知道。因为是牛人写的,这个牛人不是我,,,codeproject上的。亲测,win7 ,vs2010 无问题。
#include "CSmtp.h" #include <iostream> int main() { bool bError = false; try { CSmtp mail; #define test_gmail_tls #if defined(test_gmail_tls) mail.SetSMTPServer("smtp.gmail.com",587); mail.SetSecurityType(USE_TLS); #elif defined(test_gmail_ssl) mail.SetSMTPServer("smtp.gmail.com",465); mail.SetSecurityType(USE_SSL); #elif defined(test_hotmail_TLS) mail.SetSMTPServer("smtp.live.com",25); mail.SetSecurityType(USE_TLS); #elif defined(test_aol_tls) mail.SetSMTPServer("smtp.aol.com",587); mail.SetSecurityType(USE_TLS); #elif defined(test_yahoo_ssl) mail.SetSMTPServer("plus.smtp.mail.yahoo.com",465); mail.SetSecurityType(USE_SSL); #endif mail.SetLogin("***"); mail.SetPassword("***"); mail.SetSenderName("User"); mail.SetSenderMail("user@domain.com"); mail.SetReplyTo("user@domain.com"); mail.SetSubject("The message"); mail.AddRecipient("friend@domain2.com"); mail.SetXPriority(XPRIORITY_NORMAL); mail.SetXMailer("The Bat! (v3.02) Professional"); mail.AddMsgLine("Hello,"); mail.AddMsgLine(""); mail.AddMsgLine("..."); mail.AddMsgLine("How are you today?"); mail.AddMsgLine(""); mail.AddMsgLine("Regards"); mail.ModMsgLine(5,"regards"); mail.DelMsgLine(2); mail.AddMsgLine("User"); //mail.AddAttachment("../test1.jpg"); //mail.AddAttachment("c:\\test2.exe"); //mail.AddAttachment("c:\\test3.txt"); mail.Send(); } catch(ECSmtp e) { std::cout << "Error: " << e.GetErrorText().c_str() << ".\n"; bError = true; } if(!bError) std::cout << "Mail was send successfully.\n"; return 0; }