求助,关于BCB发送邮件程序,IdSMTP 的用法
代码如下:
IdSMTP1-> Host = FormConfig-> EditSMTP-> Text;
IdSMTP1-> AuthenticationType = atLogin;
IdSMTP1-> UserId = FormConfig-> EditUser-> Text;
IdSMTP1-> Password = FormConfig-> MaskEditPw-> Text;
IdSMTP1-> Port =EdtPort->Text.ToInt(); // 服务器端口25;
IdMessage1-> ContentType = "text/html ";
IdMessage1-> From-> Text = FormConfig-> EditUser-> Text;
IdMessage1->From->Address = "www@abc.com"; // 发件人地址
IdMessage1-> Recipients-> EMailAddresses = EditToAddress-> Text;
IdMessage1-> Subject = EditSubject-> Text;
IdMessage1-> Body-> Assign(MemoNewMail-> Lines);
IdMessage1-> ReceiptRecipient-> Text = FormConfig-> EditUser-> Text;
IdMessage1-> MessageParts-> Clear();
IdMessage1-> MessageParts-> Add();
IdSMTP1->Disconnect();
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( "发送邮件时出现异常 ");
ShowMessage(E.Message);
} ;
}
else{
ShowMessage( "验证,服务器连接不成功 ");
}
---------------------------
其中,收件人地址为 IdMessage1-> Recipients-> EMailAddresses = EditToAddress-> Text;
这里,只给一个人发送没有任何问题,但是我想类似写成同时有多个收件人,不知道该怎么办。
例如: EditToAddress-> Text="abc1@163.com" ; 就可以,
EditToAddress-> Text="abc1@163.com;abc2@163.com" 这样就出错。
还有,通过这样的写法,会自动有一个阅读回复的信息,我不想带过去,怎么办?谢谢。