M
myjane
Unregistered / Unconfirmed
GUEST, unregistred user!
(smtp.263.net)用idsmtp发邮件时老是提示"邮件服务器要求SMTP验证信息", AuthenticationType := atLogin; (50分)<br />{* delphi 7.0*}
function SmtpSendMail(FromAddress, ToAddress, ASubject, MsgBody: string):
Boolean;
const
sHost = 'smtp.263.net'; //主机地址
sUser = 'abcd'; //用户名
sPass = 'abcd'; //密码
var
IdSMTP: TIdSMTP;
IdSendMsg: TIdMessage;
begin
IdSMTP := TIdSMTP.Create(nil);
IdSendMsg := TIdMessage.Create(IdSMTP);
try
Result := False;
with IdSendMsg do {邮件信息}
begin
Body.Text := MsgBody;
From.Text := FromAddress;
Recipients.EMailAddresses := ToAddress;
Subject := ASubject;
end;
with IdSMTP do
begin
AuthenticationType := atLogin;
UserID :=sUser;
Password :=sPass;
Host := sHost; {主机信息}
Port := 25;
Connect;
try
Send(IdSendMsg);
Result := True;
finally
Disconnect;
end;
end;
finally
IdSendMsg.Free;
IdSMTP.Free;
end;
end;
function SmtpSendMail(FromAddress, ToAddress, ASubject, MsgBody: string):
Boolean;
const
sHost = 'smtp.263.net'; //主机地址
sUser = 'abcd'; //用户名
sPass = 'abcd'; //密码
var
IdSMTP: TIdSMTP;
IdSendMsg: TIdMessage;
begin
IdSMTP := TIdSMTP.Create(nil);
IdSendMsg := TIdMessage.Create(IdSMTP);
try
Result := False;
with IdSendMsg do {邮件信息}
begin
Body.Text := MsgBody;
From.Text := FromAddress;
Recipients.EMailAddresses := ToAddress;
Subject := ASubject;
end;
with IdSMTP do
begin
AuthenticationType := atLogin;
UserID :=sUser;
Password :=sPass;
Host := sHost; {主机信息}
Port := 25;
Connect;
try
Send(IdSendMsg);
Result := True;
finally
Disconnect;
end;
end;
finally
IdSendMsg.Free;
IdSMTP.Free;
end;
end;