X
xddl
Unregistered / Unconfirmed
GUEST, unregistred user!
我用得C++Builder5,Indy9做得邮件处理程序,发件服务器是smtp.21cn.com
要求认证。程序非常简单:
void __fastcall TForm1::BSendClick(TObject *Sender)
{
Screen->Cursor = crHourGlass;
IdSMTP1->Host = ESMTPHost->Text;
if(CBAuth->Checked)
{
IdSMTP1->AuthenticationType = atLogin;
IdSMTP1->Username = EFromUser->Text;
IdSMTP1->Password = ESMTPkey->Text;
}
else
IdSMTP1->AuthenticationType = atNone;
IdMessage1->Clear();
IdMessage1->Body->Assign( MemoSend->Lines);
IdMessage1->From->Address = EFromMan->Text; //信件写信人
IdMessage1->Sender->Address = EFromMan->Text; //信件发信人
IdMessage1->ReplyTo->EMailAddresses = EFromMan->Text; //发送回复的地址
IdMessage1->Recipients->EMailAddresses = EReceivMan->Text; //收件人
IdMessage1->Subject = ESubject->Text; //主题
IdMessage1->CharSet = ECode->Text; //编码方式
try{
IdSMTP1->Connect(2500);
IdSMTP1->Send(IdMessage1);
}catch(Exception& E)
{
MLog->Lines->Add("Error: " + E.Message);
goto END;
}
END:
IdSMTP1->Disconnect();
Screen->Cursor = crDefault;
}
//---------------------------------------------------------------------------
什么错误都没有,就是收不到。
不明白?
是否21CN有特殊要求?
要求认证。程序非常简单:
void __fastcall TForm1::BSendClick(TObject *Sender)
{
Screen->Cursor = crHourGlass;
IdSMTP1->Host = ESMTPHost->Text;
if(CBAuth->Checked)
{
IdSMTP1->AuthenticationType = atLogin;
IdSMTP1->Username = EFromUser->Text;
IdSMTP1->Password = ESMTPkey->Text;
}
else
IdSMTP1->AuthenticationType = atNone;
IdMessage1->Clear();
IdMessage1->Body->Assign( MemoSend->Lines);
IdMessage1->From->Address = EFromMan->Text; //信件写信人
IdMessage1->Sender->Address = EFromMan->Text; //信件发信人
IdMessage1->ReplyTo->EMailAddresses = EFromMan->Text; //发送回复的地址
IdMessage1->Recipients->EMailAddresses = EReceivMan->Text; //收件人
IdMessage1->Subject = ESubject->Text; //主题
IdMessage1->CharSet = ECode->Text; //编码方式
try{
IdSMTP1->Connect(2500);
IdSMTP1->Send(IdMessage1);
}catch(Exception& E)
{
MLog->Lines->Add("Error: " + E.Message);
goto END;
}
END:
IdSMTP1->Disconnect();
Screen->Cursor = crDefault;
}
//---------------------------------------------------------------------------
什么错误都没有,就是收不到。
不明白?
是否21CN有特殊要求?