////////////////////////////////////////////////////////////////////////////////
// Original class CFastSmtp written by
// christopher w. backen <immortal@cox.net>
// More details at: http://www.codeproject.com/KB/IP/zsmtp.aspx
//
// Modifications introduced by Jakub Piwowarczyk:
// 1. name of the class and functions
// 2. new functions added: SendData,ReceiveData and more
// 3. authentication added
// 4. attachments added
// 5 .comments added
// 6. DELAY_IN_MS removed (no delay during sending the message)
// 7. non-blocking mode
// More details at: http://www.codeproject.com/KB/mcpp/CSmtp.aspx
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// SSL/TLS support added by John Tang by making use of OpenSSL: http://www.openssl.org/
// More details at: http://www.codeproject.com/KB/IP/smtp_ssl.aspx
//
// PLAIN, CRAM-MD5 and DIGESTMD5 authentication added by David Johns
//
// Revision History:
// - Version 2.4: Updated with fixes reported as of 22 Oct 2015
// > Fixed issues with files being left opened and buffer not being deleted if an error occurs as discussed here: http://www.codeproject.com/Messages/4651730/Re-File-attachment.aspx
// - Thanks to Josep Sol�
// > Fixed issue with opening attachments as discussed here: http://www.codeproject.com/Messages/4640325/File-path-mistakenly-ommitted-from-file-name-when-.aspx
// - Thanks to Graham
// > Fixed potential memory leak as discussed here: http://www.codeproject.com/Messages/5010012/Memory-leaks.aspx
// - Thanks to LahPo
// > Made total message size limit larger as recommended here: http://stackoverflow.com/questions/22426686/csmtp-wont-send-an-e-mail-attachment-but-without-the-attachment-it-works-fine/28333737#28333737
// - Thanks to Stanislav
// > Fixed an issue with incomplete attachment file paths as discussed here: http://www.codeproject.com/Messages/5127588/Re-Attachment-does-not-come.aspx
// - Thanks to Member 11508846 and Member 11887128
// - Version 2.3: Updated with fixes reported as of 17 Aug 2013
// > Removed Bcc header so that recipients don't see who it was Bcc'd to as discussed here: http://www.codeproject.com/Messages/4633562/Bcc-and-mail-header.aspx
// - Thanks to o15s19
// > Fixed problem with attaching files that have unicode or reserved character filenames as discussed here: http://www.codeproject.com/Messages/4610174/Re-About-snprintf-FileName-255-Attachments-FileId-.aspx
// - Thanks to uni_gauldoth
// > Improved the method used for checking attachment file sizes as discussed here: http://www.codeproject.com/Messages/4562481/retreiving-file-size-for-attachments.aspx
// - Thanks to GKarRacer
// > Added #include <unistd.h> for linux compiles, which was required for gethostname as discussed here: http://www.codeproject.com/Messages/4551908/Works-on-Linux-CSmtp-cpp-needed-sharpinclude-unist.aspx
// - Thanks to jim fred
// - Version 2.2: Updated with fixes reported as of 6 May 2013
// > Fixed check on MsgBody.size() as discussed here: http://www.codeproject.com/Messages/4555663/Incorrect-range-check.aspx
// - Thanks to GKarRacer
// > Moved memory allocation and checking if attachments could be opened to before the MAIL command is
// issued to avoid throwing errors in a place where you can't terminate the connection gracefully without
// the email being sent corrupted
// > Changed all sprintf calls to snprintf to add greater security. #define'd snprintf to sprintf_s for
// MSVC. Also changed all strcpy to snprintf since that is the only way to use a secure function that
// is portable between standard C and MSVC since MS re-ordered the arguments between strcpy and
// strcpy_s
// > Fixed issue with SayQuit that could lead to infinite loop discussed here: http://www.codeproject.com/Messages/4451901/exception-in-SayQuit-could-lead-to-infinite-loop.aspx
// - Thanks to jcyangzh!
// > Fixed issue with AUTH PLAIN implementation discussed here: http://www.codeproject.com/Messages/4433069/looks-like-a-bug-in-plain-auth.aspx
// - Thanks to sbrytskyy!
// - Version 2.1: Updated with fixes reported as of 26 Mar 2012
// > Fixed issue in main.cpp with referring to USE_TLS in the wrong scope discussed here: http://www.codeproject.com/Messages/4151405/Re-USE_SSL-no-member-of-CSmtp.aspx
// - Thanks to Alan P Brown!
// > Added modifications to allow it to compile in Debian Linux discussed here: http://www.codeproject.com/Messages/4132697/linux-port-patch.aspx
// - Thanks to Oleg Dolgov!
// > Added ability to change the character set, inspired by this post: http://www.codeproject.com/Messages/4238701/Re-The-subject-contains-the-Chinese-letters-could-.aspx
// - Thanks to LeonHuang0726 and John TWC for the suggestion!
// > Added ability to request a read receipt by calling SetReadReceipt as proposed here: http://www.codeproject.com/Messages/3938944/Disposition-Notification-To.aspx
// - Thanks to Gospa for the suggestion!
// > Added check for Linux when adding paths of attachments in the MIME header as suggested here: http://www.codeproject.com/Messages/4357144/portability-bug-w-attachment-name.aspx
// - Thanks to Spike!
// > Switched method of setting private std::string variables to use the = operator as suggested here: http://www.codeproject.com/Messages/4356937/portability-bugs-w-std-string-and-exceptions.aspx
// - Thanks to Spike!
// > Added SetLocalHostName function proposed here: http://www.codeproject.com/Messages/4092347/bug-fixes-GetLocalHostName-Send.aspx
// - Thanks to jerko!
// > Added the modifications to allow it to compile in Linux described here: http://www.codeproject.com/Messages/3878620/My-vote-of-5.aspx
// - Thanks to korisk!
// > Added the fix that corrects behavior when m_sNameFrom is empty described here: http://www.codeproject.com/Messages/4196071/Bug-Mail-sent-by-mail-domain-com.aspx
// - Thanks to agenua.grupoi68!
// - Version 2.0: Updated to all fixes reported as of 23 Jun 2011:
// > Added the m_bAuthenticate member variable to be able to disable authentication
// even though it may be supported by the server. It defaults to true so if it is
// not set the library will act as it would have before the addition.
// > Added the ability to pass the security type, m_type, the new m_Authenticate flag,
// the login and password into the ConnectRemoteServer function. If these new arguments
// are not included in the call the function will work as it did before.
// > Added the ability to pass the new m_Authenticate flag into the SetSMTPServer function.
// If not provided, the function will act as it would before the addition.
// > Added fix described here: http://www.codeproject.com/Messages/3681792/Bug-when-reading-answer.aspx
// - Thanks to Martin Kjallman!
// > Added fixes described here: http://www.codeproject.com/Messages/3707662/Mistakes.aspx
// - Thanks to Karpov Andrey!
// > Added fixes described here: http://www.codeproject.com/Messages/3587166/Re-Possible-Solution-To-Misc-EHLO-Errors.aspx
// - Thanks to Jakub Piwowarczyk!
// - Version 1.9: Started with Revion 6 in code project http://www.codeproject.com/script/Articles/ListVersions.aspx?aid=98355
////////////////////////////////////////////////////////////////////////////////
#include "CSmtp.h"
#include "base64.h"
#include "openssl/err.h"
#include <cassert>
#ifndef LINUX
//Add "openssl-0.9.8l\out32" to Additional Library Directories
#pragma comment(lib, "ssleay32.lib")
#pragma comment(lib, "libeay32.lib")
#endif
Command_Entry command_list[] =
{
{command_INIT, 0, 5*60, 220, EC
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
C++邮件发送功能解决了SSL验证的问题.zip (81个子文件)
CSmtp_v2_4_ssl
md5.h 4KB
CSmtp.vcproj 6KB
Article Source.htm 17KB
base64.h 190B
openssl-0.9.8l
out32
ssleay32.lib 677KB
libeay32.lib 3.79MB
inc32
openssl
md5.h 5KB
pq_compat.h 6KB
krb5_asn.h 7KB
rand.h 6KB
ec.h 21KB
des.h 10KB
pem.h 28KB
idea.h 4KB
asn1.h 48KB
aes.h 6KB
rc4.h 4KB
bn.h 33KB
comp.h 2KB
ossl_typ.h 7KB
lhash.h 7KB
des_old.h 18KB
ssl2.h 10KB
ocsp.h 24KB
rc2.h 4KB
ecdh.h 5KB
blowfish.h 5KB
conf_api.h 4KB
buffer.h 4KB
dsa.h 11KB
obj_mac.h 125KB
md4.h 5KB
hmac.h 4KB
tls1.h 19KB
dh.h 8KB
pkcs7.h 16KB
e_os2.h 9KB
symhacks.h 20KB
pkcs12.h 12KB
dtls1.h 6KB
ecdsa.h 10KB
crypto.h 24KB
opensslv.h 4KB
bio.h 30KB
objects.h 33KB
ui.h 16KB
ripemd.h 4KB
err.h 13KB
x509.h 47KB
x509v3.h 29KB
pem2.h 3KB
tmdiff.h 4KB
txt_db.h 4KB
ssl3.h 22KB
ui_compat.h 3KB
sha.h 7KB
dso.h 16KB
pqueue.h 3KB
kssl.h 6KB
ssl23.h 4KB
conf.h 9KB
safestack.h 139KB
x509_vfy.h 20KB
cast.h 4KB
store.h 26KB
md2.h 4KB
evp.h 38KB
ssl.h 82KB
opensslconf.h 7KB
rsa.h 19KB
engine.h 38KB
asn1_mac.h 19KB
asn1t.h 27KB
stack.h 4KB
ebcdic.h 540B
CSmtp.cpp 75KB
md5.cpp 13KB
CSmtp.sln 874B
CSmtp.h 7KB
main.cpp 2KB
base64.cpp 4KB
共 81 条
- 1
资源评论
- wang56995652018-04-18编译通过,可以发邮件了,学习了
- 诗2019-01-02不好用了,时间太久了
- _捕风捉影_2017-04-03可以用来参考
lly725
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功