smtp控件中身份认证问题(100分)

  • 主题发起人 主题发起人 zh.nux
  • 开始时间 开始时间
Z

zh.nux

Unregistered / Unconfirmed
GUEST, unregistred user!
现在使用邮件客户端发送邮件时,都要求smtp身分认证,可是smtp中只是提供了UserID属性,
没有password属性,我现在想自己写一个客户端,怎么处理呢??????
 
哎,就是现在的smtp服务器为了控制垃圾邮件,不是要求发送邮件前都要认证用户的省份吗,
就是这个功能我用smtp控件自己做,怎样添上去。[:)]
 
http://www.ccw.com.cn/htm/app/down/1204Source.zip
 
用IdSMTP呢?它有个socksinfo属性组,不知道是不是
 
楼上的,socksinfo属性组是用来设置代理防火墙的信息的!!
to intcom,
你给的 程序不能运行,我觉得常理也不对,没有设置smtp服务器,怎么能发邮件呢??
 
txyqbf_gxx@163.com 我卖你一个 your box???
 
这个我也想知道,但怎么看不到大家的回复??
 
http://www.ccw.com.cn/htm/app/down/1204Source.zip
很好用,但有些网站给封杀了如 263
 
人在昆明,我也在昆明。
先看看能不能用塞,有用我再买
 
我可没说 要卖钱,是 大富翁 币,留个信箱吧,我发给你,不过我可能要下个星期才能
看到回复拉,放假!
 
to 人在昆明
好啊,zhanghui_666@netease.com
try ,try
 

欧在网上找到的:

在connect里面这样写:

procedure TForm1.NMSMTP1Connect(Sender: TObject);
var
strUserName,strPassword:string;
begin
strUserName:=EncodeString('XXXXX');
strPassword:=EncodeString('XXXXX');

nmsmtp1.Transaction('auth login');
nmsmtp1.Transaction(strUserName);
nmsmtp1.Transaction(strPassword);

end;

下面两个是EncodeString编码函数(不知道注释怎么成了乱码了:))

function EncodeBASE64(Encoded: TMemoryStream ; Decoded: TMemoryStream): Integer;
const
_Code64: String[64] =
('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/');
var
I: LongInt;
B: array[0..2279] of Byte;
J, K, L, M, Quads: Integer;
Stream: string[76];
EncLine: String;
begin
Encoded.Clear;
Stream := '';
Quads := 0;
{ΪÌá¸ßЧÂÊ£¬Ã¿2280×Ö½ÚÁ÷Ϊһ×é½øÐбàÂë}
J := Decoded.Size div 2280;
Decoded.Position := 0;
{¶ÔÇ°J*2280¸ö×Ö½ÚÁ÷½øÐбàÂë}
for I := 1 to J do
begin
Decoded.Read(B, 2280);
for M := 0 to 39 do
begin
for K := 0 to 18 do
begin
L:= 57*M + 3*K;
Stream[Quads+1] := _Code64[(B[L] div 4)+1];
Stream[Quads+2] := _Code64[(B[L] mod 4)*16 + (B[L+1] div 16)+1];
Stream[Quads+3] := _Code64[(B[L+1] mod 16)*4 + (B[L+2] div 64)+1];
Stream[Quads+4] := _Code64[B[L+2] mod 64+1];
Inc(Quads, 4);
if Quads = 76 then
begin
Stream[0] := #76;
EncLine := Stream+#13#10;
Encoded.Write(EncLine[1], Length(EncLine));
Quads := 0;
end;
end;
end;
end;

{¶ÔÒÔ2280ΪģµÄÓàÊý×Ö½ÚÁ÷½øÐбàÂë}
J := (Decoded.Size mod 2280) div 3;
for I := 1 to J do
begin
Decoded.Read(B, 3);
Stream[Quads+1] := _Code64[(B[0] div 4)+1];
Stream[Quads+2] := _Code64[(B[0] mod 4)*16 + (B[1] div 16)+1];
Stream[Quads+3] := _Code64[(B[1] mod 16)*4 + (B[2] div 64)+1];
Stream[Quads+4] := _Code64[B[2] mod 64+1];
Inc(Quads, 4);
{ÿÐÐ76¸ö×Ö·û}
if Quads = 76 then
begin
Stream[0] := #76;
EncLine := Stream+#13#10;
Encoded.Write(EncLine[1], Length(EncLine));
Quads := 0;
end;
end;
{¡°=¡±²¹Î»}
if (Decoded.Size mod 3) = 2 then
begin
Decoded.Read(B, 2);
Stream[Quads+1] := _Code64[(B[0] div 4)+1];
Stream[Quads+2] := _Code64[(B[0] mod 4)*16 + (B[1] div 16)+1];
Stream[Quads+3] := _Code64[(B[1] mod 16)*4 + 1];
Stream[Quads+4] := '=';
Inc(Quads, 4);
end;

if (Decoded.Size mod 3) = 1 then
begin
Decoded.Read(B, 1);
Stream[Quads+1] := _Code64[(B[0] div 4)+1];
Stream[Quads+2] := _Code64[(B[0] mod 4)*16 + 1];
Stream[Quads+3] := '=';
Stream[Quads+4] := '=';
Inc(Quads, 4);
end;

Stream[0] := Chr(Quads);
if Quads > 0 then
begin
EncLine := Stream+#13#10;
Encoded.Write(EncLine[1], Length(EncLine));
end;

Result := Encoded.Size;
end;

{¶Ô²ÎÊýDecoded×Ö·û´®½øÐÐBase64±àÂ룬·µ»Ø±àÂëºóµÄ×Ö·û´®}
function EncodeString(Decoded:string):String;
var
mmTemp,mmDecoded:TMemoryStream;
strTemp:TStrings;
begin
mmTemp := TMemoryStream.Create;
mmDecoded:=TMemoryStream.Create;
strTemp:=TStringList.Create;
strTemp.Add(Decoded);
strTemp.SaveToStream(mmTemp);
mmTemp.Position := 0;
{ÌÞ³ýmmTemp´ÓstrTempÖдøÀ´µÄ×Ö·û#13#10}
mmDecoded.CopyFrom(mmTemp,mmTemp.Size-2);
{¶ÔmmDecoded½øÐÐBase64±àÂ룬ÓÉmmTemp·µ»Ø±àÂëºóµÄ½á¹û}
EncodeBASE64(mmTemp,mmDecoded);
{»ñµÃBase64±àÂëºóµÄ×Ö·û´®}
mmTemp.Position:=0;
strTemp.LoadFromStream(mmTemp);
{·µ»Ø½á¹û±ØÐë´ÓstrTemp[0]ÖлñµÃ£¬Èç¹ûʹÓÃstrTemp.Text»á
´øÀ´²»±ØÒªµÄ×Ö·û#13#10}
Result:=strTemp[0];
end;
 
turbopower的控件可以搞定
 
后退
顶部