18760InternetInternetchnia-pub.com70%Inter-netEmailC++BuilderAccess2000C++BuilderTIdSMTPTIdSMTP11.1SMTPSMTPIETF(internetengineeringtaskforce)SMTPSMTPSMTPSMTPSMTPSMTPSMTPSMTPMAILFROMmybox@hunau.netSMTPSMTPSMTP250SMTPRFC8211.2ESMTPSMTPSMTP19993SMTPSMTPServiceExtensionforAuthenticationRFC2544ESMTPSMTP(simpleauthenticationandsecuritylayerSASL)SMTPAUTHAUTHLOGINCRAM-MD5PLAIN2005-03-18(1978)(410128)C++BuilderAccess2000C++BuilderTIdSMTPTIdSMTP;;TIdSMTP;TIdMessage;ADO;C++BuilderTP393.098A1000-7024(2006)10-1876-03DesignandimplementationofbulkemailsendingsystemFUZhuo-jun,LUOYi-rong,DAIXiao-peng(ComputerandInformationEngineeringCollege,HunanAgriculturalUniversity,Changsha410128,China)AbstractThemethodofbulkemailsendinghasbeenappliedine-businessesandnetworkselling.Theenterpriseswithintranetcouldsendinformsanddocumentbyusingbulkemailquicklyandconveniently.Thetheoryofemailsendingisintroduced.AndtwomethodsofimplementationofbulkemailsendingbasedonC++BuilderandAccess2000arepresented.Finally,TIdSMTPcomponentofC++BuilderindetailandtheexamplecodesusingC++Buildertocarryoutbulkemailsendingaregiven.Keywordsbulkemailsending;authentication;TIdSMTP;TidMessage;ADO;C++Builder20065May20062710Vol.27No.10ComputerEngineeringandDesign1877LOGINSMTP-22.1SMTPSMTPSMTPSMTPC++BuilderTIdSMTPSMTPMailListAccess2000C++BuilderTADOTableADOAccess20002.2ADOC++BuilderBorlandBDEBDEADOActiveXDataObjectsADOC++BuilderADOTADOTableAccess2000Void__fastcallTForm1::N_OpenClick(TObject*Sender){AnsiStringConnStr;try{ADOTable1-Active=false;//OpenDialog1-InitialDir=.\\;OpenDialog1-Filter=MDB(*.mdb)|*.mdb|(*.*)|*.*;OpenDialog1-DefaultExt=String(mdb);//if(OpenDialog1-Execute()){ConnStr=Provider=Microsoft.Jet.OLEDB.4.0;JetOLE-DB:DatabasePassword=+MaskEdit1-Text.Trim()+;DataSource=+OpenDialog1-FileName.Trim()+;PersistSecurityInfo=True;ADOTable1-ConnectionString=ConnStr.Trim();ADOTable1-Active=true;}catch(Exception&exception){Application-ShowException(&exception);}}Access20002.3TIdSMTPC++Builder6.0INDYInternetINDY106.0C++BuilderINDY,smtp.sohu.comPortSMTPTCP25AuthenticationTypeSMTPLOGINUserIDPasswordConnect()SMTPDisconnect()SMTPSend(Amsg:IdMessage)Connected()SMTPDisconnected()SMTP2TIdMessageContentTypetext/htmlSubjectBodyFrom-NameRecipients-EMailAddressesEMAIL1878void__fastcallTForm1::SEND_BTNClick(TObject*Sender){intrecnum,k;AnsiStringaddr;IdSMTP1-Host=ComboBoxaddr-Text.Trim();//SMTPIdSMTP1-Port=25;if(CheckBox_AUTH-Checked==true)//SMTP{IdSMTP1-AuthenticationType=atLogin;IdSMTP1-UserId=Edit_name-Text.Trim();IdSMTP1-Password=MaskEdit_pass-Text.Trim();}IdMessage1-ContentType=text/html;//IdMessage1-Subject=Edit3-Text.Trim();......ADOTable1-First();//recnum=ADOTable1-RecordCount;for(k=0;k=recnum-1;k++){addr=Trim(ADOTable1-FieldByName(Email)-AsString);IdMessage1-Recipients-EMailAddresses=addrif(!IdSMTP1-Connected()){try{IdSMTP1-Connect();}catch(Exception&e){Application-MessageBox(e.Message,SMTP,MB_ICONWARNING);}}if(IdSMTP1-Connected()){try{IdSMTP1-Send(IdMessage1);}catch(Exception&e){Application-MessageBox(e.Message,,MB_ICONWARNING);}}ADOTable1-Next();}Application-MessageBox(!,,MB_OK);......}2.4TIdSMTPRFC821forward-pathvoid__fastcallTForm1::SEND_BTNClick(TObject*Sender){AnsiStringaddr;......//SMTPADOTable1-First();while(!ADOTable1-Eof){for(inti=0;i10;i++)//10forward-path{AnsiStringtmpstr;tmpstr=Trim(ADOTable1-FieldByName(Email)-AsString);if(tmpstr.Length()!=0&&addr.Length()==0)addr=tmpstr;elseif(tmpstr.Length()!=0&&addr.Length()!=0)addr=addr+,+tmpstr;ADOTable1-Next();}IdMessage1-Recipients-EMailAddresses=addr;......//TIdSMTPaddr=;}}3SMTPLOGINLOGINBASE64LOGINCRAM-MD5++BuilderTTimerIntervalSMTPSMTP:[1],,.SMTP[J].(),2003,28(2):83-86.[2],.SMTP[J].,2004,25(9):1526-1528.[3],.SMTP[J].(),2004,20(8):47-48.[4]RichardBlum.[M].:,2004.[5]CharlieCalvert.C++BUILDER[M].:,1999.[6]RFC(RFCinternationalorganization).RFC(RFCdocument)[EB/OL].[7]RFC(RFCinternationalorganization).RFC(RFCdocument)[EB/OL].[8]RFC(RFCinternationalorganization).RFC(RFCdocument)[EB/OL].[9]RFC(RFCinternationalorganization).RFC(RFCdocument)[EB/OL].