503 bad sequence of commands 错误
IdSMTP1->Host = Host;
IdSMTP1->Port = Port;
IdSMTP1->AuthenticationType = atLogin;
IdSMTP1->UserId = UserId; //我的登陆名
IdSMTP1->Password = Password; //我的密码
IdMessage1->Recipients->EMailAddresses = EMailAddresses; //另一个接受邮件的邮箱
//IdMessage1->ContentType = "text/html";
IdMessage1->Subject = "邮件主题";
IdMessage1->Body->Assign(Memo1->Lines); //此处设置邮件内容
IdMessage1->From->Address = Address;
try
{
IdSMTP1->Connect();
}
catch(...)
{
MessageDlg("Error",mtInformation, TMsgDlgButtons() << mbOK, 0);
Abort();
}
try
{
IdSMTP1->Send (IdMessage1);
}
catch(...)
{
IdSMTP1->Disconnect();
}
一运行就提示: 503 bad sequence of commands