欢迎来到天天文库
浏览记录
ID:41127524
大小:24.69 KB
页数:15页
时间:2019-08-17
《使用smtp发送邮件(源码)》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、使用smtp发送邮件(源码)源文件: #include #pragmahdrstop #include"sendmail.h" #include"mmsystem.h" #pragmapackage(smart_init) structRecvEmailInfo { AnsiString strSubject,strFrom,strTo,strContent,strCmdDate,strCmdNum; int nRecNum,nSendCount; TList *Attac
2、hList; }; structAttachInfo { AnsiString FileName; int Length; BYTE *Content; }; __fastcallTSendMailThread::TSendMailThread(boolCreateSuspended,intsleeptime) :TThread(CreateSuspended) { Ftime =sleeptime; FreeOnTerminate=true;
3、 nSendFlag =-1; nCommandKind =0; strBoundary ="----Mailor_of_qurqur.China----"; RecvEmailList=newTList; /*TMemoryStream*ms=newTMemoryStream(); ms->LoadFromFile("d:\test.txt"); RecvEmailInfo*pREI; AttachInfo*pAI; for(inti=0;i<5;i++)
4、 { pAI=newAttachInfo; pREI=newRecvEmailInfo; pAI->FileName="test.txt"; pAI->Length =ms->Size; pAI->Content=newBYTE[ms->Size]; ms->Position=0; ms->ReadBuffer(pAI->Content,ms->Size); pREI->AttachList=newTList;
5、 pREI->AttachList->Add(pAI); pREI->strSubject="humor"; pREI->strFrom="qurqur@163.net"; pREI->strTo ="qurqur@163.net; pREI->strContent="test"; pREI->nSendCount=5; RecvEmailList->Add(pREI); } deletems;*/ } void__fastcallT
6、SendMailThread::Execute() { WORDwVersionRequested; WSADATAwsaData; interr; wVersionRequested=MAKEWORD(2,2); err=WSAStartup(wVersionRequested,&wsaData); if(err!=0) { //TelltheuserthatwecouldnotfindausableWinSockDLL. return; }
7、 if(LOBYTE(wsaData.wVersion)!=2
8、
9、HIBYTE(wsaData.wVersion)!=2) { //TelltheuserthatwecouldnotfindausableWinSockDLL. WSACleanup(); return; } while(!Terminated) {
此文档下载收益归作者所有