想问一下在delphi7里怎样实现自动发邮件的功能

如题所述

IdSMTP1.AuthenticationType := atNone;

IdSMTP1.Connect;

try if

IdSMTP1.AuthSchemesSupported.IndexOf('LOGIN')>-1 then

begin

IdSMTP1.AuthenticationType := atLogin;

IdSMTP1.Authenticate;

end;

IdSMTP1.Send(IdMessage1);

finally

IdSMTP1.Disconnect;

end;

顶.
procedure TForm1.SendEmail(EAddress: String;SContent:string); //发 Mail
begin
try
IdSMTP1.Host:='192.168.30.13';//smtp Server KSMAIL03 '192.168.30.13'
IdSMTP1.Port:=25; //SMTP 端口
IdSMTP1.Username:='';
IdSMTP1.Password:='';
IdSMTP1.Connect();
except
exit;
end;
try
IdMessage1.Body.Clear;
IdMessage1.Body.Add(SContent); //Content
IdMessage1.From.Text:='[email protected]'; //From
IdMessage1.Recipients.EMailAddresses:=Trim(EAddress);
IdMessage1.Subject:='未刷卡记录通知'; //Title
IdSMTP1.Send(IdMessage1);
finally
IdSMTP1.Disconnect;
end;
end;
IdSMTP
温馨提示:答案为网友推荐,仅供参考
相似回答