???请帮我看一下这一段关于IDSMTP的代码,谢谢!

shonsy 2003-12-18 08:42:28
我每次运行时使用瑞星监控,能够通过验证,看到邮件发出去的过程,但是最后返回协议错误,收不到邮件,不知道为什么,请教大侠,谢谢!

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();
}

}
...全文
86 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
shonsy 2003-12-18
  • 打赏
  • 举报
回复
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;
IdSMTP1->UserId=Edit6->Text;
IdSMTP1->Password=Edit7->Text;

try{
IdSMTP1->Connect();
Application->ProcessMessages();
Application->ProcessMessages();
IdSMTP1->Send(IdMsgSend);
Application->ProcessMessages();
Application->ProcessMessages();
}


__finally{
IdSMTP1->Disconnect();
}

}

1,317

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 网络及通讯开发
社区管理员
  • 网络及通讯开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧