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