亿万火急!!!!!!!!!!!!!关于邮件发送!

crazycock 2001-07-01 08:55:29
如果使程序发送邮件时通过发信认证?
我好象听说Indy可以,不过他的Demo好象都有问题,需要什么额外设置么?
或者还有什么更好用的组件?
如果可以,直接发到我的信箱中:crazycock@371.net
谢谢谢谢谢谢谢了……
...全文
601 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
crazycock 2001-07-03
  • 打赏
  • 举报
回复
什么是阻塞模式模式?
david_ye 2001-07-02
  • 打赏
  • 举报
回复
Indy是阻塞模式, 可以设置自己定义的一些协议,当发送邮件时,根据协议来控制.
InsideDelphi 2001-07-02
  • 打赏
  • 举报
回复
用NMSMTP即可,注意重载对应的OnConnect函数
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Psock, NMsmtp;

type
TForm1 = class(TForm)
NMSMTP1: TNMSMTP;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure NMSMTP1Connect(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const BaseTable:string='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';


var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
//在此之前要初始化对应的NMSMTP1得相关内容
NMSMTP1.PostMessage.Date:=DateTimeToStr(Now);
NMSMTP1.Connect;
NMSMTP1.SendMail;
NMSMTP1.Disconnect;
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;

procedure TForm1.NMSMTP1Connect(Sender: TObject);
begin
if nmsmtp1.ReplyNumber = 250 then
nmsmtp1.Transaction('auth login');
if nmsmtp1.ReplyNumber =334 then
nmsmtp1.Transaction(EncodeBase64(YourUserName));
if nmsmtp1.ReplyNumber =334 then
nmsmtp1.Transaction(EncodeBase64(YourPassWord));

end;

end.
Aho 2001-07-01
  • 打赏
  • 举报
回复
turbopower的smtp component有相关的方法,可以让你
处理低层的一些消息,包括认证了。
copy_paste 2001-07-01
  • 打赏
  • 举报
回复
gz,我写的也没注意这点问题:)

5,392

社区成员

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

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