procedure TForm1.Button1Click(Sender: TObject);
begin
with IdMessage1 do
begin
idmessage1.AddHeader('大家好,我是太阳');
Body.Text:='Test mail here';
From.Text:='[email protected]';
Recipients.EMailAddresses :='[email protected]';
Subject:='大家好,我是太阳';
end;
try
idsmtp1.Send(idmessage1);
MessageDlg('邮件传送成功!', mtInformation, [mbOK], 0);
finally
IdSMTP1.Disconnect;
end;
end;procedure TForm1.Button2Click(Sender: TObject);
begin
idsmtp1.Host:=edt_smtp.Text;
idsmtp1.Port:=strtoint(edt_port.Text);
idsmtp1.Username:=edt_name.Text;
idsmtp1.Password:=edt_pass.Text;
idsmtp1.AuthenticationType:=atLogin;
idsmtp1.Connect;
MessageDlg('连接成功!', mtInformation, [mbOK], 0);
//idsmtp1.Authenticate;
end;我在点击BUTTON1时.总会提醒我。AUTHENTICATION FAILED
请高手指点指点
你换一个不需要身份认证的主机试试吧。李战.深圳
http://www.nevrona.com/indy中下载demo,里边找到一个mailclient的例子的代码,看看就知道了。