他可能不在吧,不过你问e-mail的问题,他应该比较在行
解决方案 »
- vmware环境下安装了win2003,请问
- 请大伙帮看一看,一按钮多任务,为什么出现好多错误?
- 哪里能买到局域网内点对点的语音控件啊,不分编程平台。请联系我 qq:362503784。
- 请教高手,关于在TCP连接中前两次握手,其中的最大报文长度(MSS)的问题!!
- 我是搞vc的,不懂delphi,需要调用一个delphi的DLL, 传入的字符串老有问题,盼望高手进来看看.
- 怎样写这个报表的语句?
- 今天升三角,高兴!现散分100,限20人人够结贴.
- 谁有有关DUnit的文档或下载地址
- 创建文件夹时,为什么文件夹名是英文时会报I/O error183错误?
- 求答:VC++转成DELPHI??
- 简单问题,请你帮忙!
- DLL问题,有个过程在EXE文件中时调用没有错,换成DLL中后invalid class typecast
以下是我的实现,希望对你有帮助。
procedure TForm1.Button2Click(Sender: TObject);
var
rst : smallint;
begin SMTP.UserID := 'cszhz';
SMTP.Password := '你的密码';
SMTP.Host := 'smtp.263.net';
SMTP.Port := 25;
SMTP.Connect;
try
rst := smtp.SendCmd('auth login',[]);
if rst = 334 then
begin
rst := smtp.SendCmd('用base64加密的用户名',[]);
if rst = 334 then
begin
rst := smtp.SendCmd('用base64加密的密码', []);
if rst = 235 then
showmessage('授权成功');
end;
end;
rst := smtp.SendCmd('MAIL FROM:<[email protected]>',[]);
if rst = 250 then
begin
rst := smtp.SendCmd('RCPT TO:<[email protected]>',[]);
if rst = 250 then
showmessage('存在')
else
showmessage('不存在');
end;
finally
SMTP.Disconnect;
end;
end;
//BaseTable为BASE64码表
const
BaseTable:string='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; var
function DecodeBase64(Source:string):string; //解码函数
function FindInTable(CSource:char):integer; //
function EncodeBase64(Source:string):string; //编码函数
function FindInTable(CSource:char):integer;
begin
result:=Pos(string(CSource),BaseTable)-1;
end;
////
function DecodeBase64(Source:string):string;
var
SrcLen,Times,i:integer;
x1,x2,x3,x4,xt:byte;
begin
result:='';
SrcLen:=Length(Source);
Times:=SrcLen div 4;
for i:=0 to Times-1 do
begin
x1:=FindInTable(Source[1+i*4]);
x2:=FindInTable(Source[2+i*4]);
x3:=FindInTable(Source[3+i*4]);
x4:=FindInTable(Source[4+i*4]);
x1:=x1 shl 2;
xt:=x2 shr 4;
x1:=x1 or xt;
x2:=x2 shl 4;
result:=result+chr(x1);
if x3= 64 then break;
xt:=x3 shr 2;
x2:=x2 or xt;
x3:=x3 shl 6;
result:=result+chr(x2);
if x4=64 then break;
x3:=x3 or x4;
result:=result+chr(x3);
end;
end;
/////
function EncodeBase64(Source:string):string;
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;