关于用idsmtp发送电子邮件的问题,我都整了一周了还没解决,急死了,请大家帮忙呀
我最近用c++builder开发邮件开发系统,用的控件是idsmtp,核心代码如下
IdSMTP1->Host = FormConfig->EditSMTP->Text;
IdSMTP1->AuthenticationType = atLogin;
IdSMTP1->UserId = FormConfig->EditUser->Text;
IdSMTP1->Password = FormConfig->MaskEditPw->Text;
IdMessage1->ContentType = "text/html";
IdMessage1->From->Text = FormConfig->EditUser->Text;
IdMessage1->ReplyTo->EMailAddresses = FormConfig->EditUser->Text ;
IdMessage1->From->Name = FormConfig->EditName->Text;
IdMessage1->Recipients->EMailAddresses = EditToAddress->Text;
IdMessage1->Subject = EditSubject->Text;
IdMessage1->Body->Assign(MemoNewMail->Lines);
IdMessage1->ReceiptRecipient->Text = FormConfig->EditUser->Text;
if(!IdSMTP1->Connected())
{
IdSMTP1->AuthenticationType = atLogin;
IdSMTP1->Connect();
Application->MessageBox("连接成功", "Look", MB_OK);
if( IdSMTP1->Authenticate()){
ShowMessage("授权成功,等待发送") ;
try
{IdSMTP1->Send(IdMessage1);
ShowMessage("邮件发送成功") ;
}
catch(Exception &E)
{ ShowMessage("发送邮件时出现异常");} ;
}else{
ShowMessage("Erreur d'authentification");
}
现在的问题是当我用163的邮箱给其他的邮箱发邮件时能够成功,但是当我用其他的邮箱,例如126,sina的,发送时却总是抱错,要么提示“550 user has been locked”,要么提示“501 input error”;总之不是IdSMTP1->Authenticate()不成功,就是IdSMTP1->Send(IdMessage1)不成功。真不知道是怎么回事
。请各位仁兄帮忙,我愿给分100,说到办到,都快急死我了。