邮件发送问题:(服务器认证)

skt985 2001-12-24 03:00:10
小弟用TNMSMTP发送邮件
用smtp.163.net发送,它要求有服务器认证
可是在TNMSMTP的属性和方法里都没找到哪里可以接收
username和password的,我如何才能通过服务器的认证呢?
...全文
454 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
qhuojun 2001-12-24
  • 打赏
  • 举报
回复
function EncodeBase64(Source:string):string;
const
BaseTable = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
var
Times, LenSrc, i: Integer;
x1, x2, x3, x4: Char;
xt: Byte;
begin
Result := '';
LenSrc := Length(Source);
if LenSrc mod 3 = 0 then
Times := LenSrc div 3
else
Times := LenSrc div 3 + 1;
for i := 0 to Times - 1 do
begin
if LenSrc >= (3 + i * 3) then
begin
x1 := BaseTable[(ord(Source[1 + i * 3]) shr 2)+1];
xt := (ord(Source[1 + i * 3]) shl 4) and 48;
xt := xt or (ord(Source[2 + i * 3]) shr 4);
x2 := BaseTable[xt + 1];
xt := (Ord(Source[2 + i * 3]) shl 2) and 60;
xt := xt or (Ord(Source[3 + i * 3]) shr 6);
x3 := BaseTable[xt + 1];
xt := (ord(Source[3 + i * 3]) and 63);
x4 := BaseTable[xt + 1];
end
else if LenSrc >= (2 + i * 3) then
begin
x1 := BaseTable[(Ord(Source[1 + i * 3]) shr 2) + 1];
xt := (Ord(Source[1 + i * 3]) shl 4) and 48;
xt := xt or (Ord(Source[2 + i * 3]) shr 4);
x2 := BaseTable[xt + 1];
xt := (Ord(Source[2 + i * 3]) shl 2) and 60;
x3 := BaseTable[xt + 1];
x4 := '=';
end else
begin
x1 := BaseTable[(Ord(Source[1 + i * 3]) shr 2)+1];
xt := (Ord(Source[1 + i * 3]) shl 4) and 48;
x2 := BaseTable[xt + 1];
x3 := '=';
x4 := '=';
end;
Result := Result + x1 + x2 + x3 + x4;
end;
end;

连接时的验证代码也给出来吧
procedure TForm1.FSMTPConnect(Sender: TObject);
var
passw,useri:string;
begin
passw:=passs; //取密码
useri:=copy(adds,1,pos('@',adds)-1);
if FSMTP.ReplyNumber = 250 then
FSMTP.Transaction('auth login');
if FSMTP.ReplyNumber = 334 then
begin
FSMTP.Transaction(EncodeBase64(useri));
FSMTP.Transaction(EncodeBase64(passw));
end;

end;

nowind 2001-12-24
  • 打赏
  • 举报
回复
找找以前的帖子吧,
d5也可以,但是麻烦些
outer2000 2001-12-24
  • 打赏
  • 举报
回复
用D6,INDY里面有一个控件。

5,392

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧