???请帮我看一下这一段关于IDSMTP的代码,谢谢!
我每次运行时使用瑞星监控,能够通过验证,看到邮件发出去的过程,但是最后返回协议错误,收不到邮件,不知道为什么,请教大侠,谢谢!
void __fastcall TForm1::Button1Click(TObject *Sender)
{
IdMsgSend->Clear();
IdMsgSend->Recipients->EMailAddresses ="shonsy@21cn.com"; //ÊÕ¼þÈ˵ØÖ·
IdMsgSend->Priority = TIdMessagePriority(0); //¸ßÓÅÏȼ¶
IdMsgSend->Subject = "It'a test!"; //ÓʼþÖ÷Ìâ
IdMsgSend->ReceiptRecipient->Text = "11";//Õâ¸ö×Ö¶ÎÈ粻Ϊ¿Õ±íÐÅ·¢µ½ºóÓÐÐÅϢת»Ø¡£
IdMsgSend->Body->Assign(Memo1->Lines); //ÓʼþÕýÎÄ
IdMsgSend->From->Address =Edit2->Text; //·¢¼þÈ˵ØÖ·
//·¢ËÍÓʼþ
IdSMTP1->AuthenticationType=atLogin;//ÐèÒªÑéÖ¤
IdSMTP1->Host=Edit4->Text; //·¢ËÍÓʼþ·þÎñÆ÷
IdSMTP1->Port=25;//SMTP¶Ë¿Ú£¬Ä¬ÈÏ25
IdSMTP1->UserId=Edit6->Text;//Óû§Ãû
IdSMTP1->Password=Edit7->Text;//ÃÜÂë
try{
IdSMTP1->Connect();//ÉÙÁË
Application->ProcessMessages();
Application->ProcessMessages();
IdSMTP1->Send(IdMsgSend);//·¢ËÍ´æ·ÅÔÚIdMessage1ÀïµÄÓʼþ
Application->ProcessMessages();
Application->ProcessMessages();
}
/*catch(Exception &e){
StatusBar1->SimpleText="error";
}*/
__finally{
IdSMTP1->Disconnect();
}
}