下面是我用Idsmtp发送邮件的部分代码:
if IniReadBool('MailBox','LOGCHECK',False) then
 begin
  IdSmtp1.AuthenticationType:=atLogin;
  idSmtp1.Username:= Trim(IniReadString('MailBox','MAILADDR',''));
  idSmtp1.Password:= Trim(IniReadString('MailBox','PASSWORD','')); (form1.ADS_Cw_mail.FieldByName('pwd').asstring);
 end
else
 begin
  IDSmtp1.AuthenticationType:=atNone;
 end;
idsmtp1.Host:=Trim(IniReadString('MailBox','SMTP',''));
(form1.ADS_Cw_mail.FieldByName('smtp').asstring);
idsmtp1.Port:=25;
try
 for i:=0 to edAttach.Items.Count-1 do
  begin
   TIDAttachment.Create(Idmessage1.MessageParts,edAttach.items.strings[i]);
  end;
 IdMessage1.Body.Clear;
 IdMessage1.Body.Assign(edBody.lines);
 IDMessage1.From.Address:=idSmtp1.Username;
 IdMessage1.Recipients.EMailAddresses:=trim(edTo.text);
 with IdMessage1.Recipients.Add do Address := edTo.Text;
 if edCC.text<>'' then
  with IdMessage1.CCList.Add do Address := edCC.Text;
 IdMessage1.Subject:=edTopic.text;
 Idmessage1.Date:=Now;
 Idsmtp1.Connect(10000);
 Idsmtp1.Send(IdMessage1);