想问一下在delphi7里怎样实现自动发邮件的功能 Delphi / Windows SDK/APIhttp://www.delphi2007.net/DelphiNetwork/html/delphi_20061212105758143.html
想问一下在delphi7里怎样实现如下功能:
把messagebox发出的提示信息,自动通过邮件的方式发给某一个收件人!TKS!!!
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:='WebApps@coretronic.com.cn'; //From
IdMessage1.Recipients.EMailAddresses:=Trim(EAddress);
IdMessage1.Subject:='未刷卡記錄通知'; //Title
IdSMTP1.Send(IdMessage1);
finally
IdSMTP1.Disconnect;
end;
end;
IdSMTP