CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Delphi >  VCL组件开发及应用

请问哪位师兄有收发电子邮件的程序(含源码)?

楼主sqq()2001-12-25 10:54:34 在 Delphi / VCL组件开发及应用 提问

请问哪位师兄有收发电子邮件的程序(含源码)?谢谢。分数不够可再加。 问题点数:80、回复次数:9Top

1 楼sqq()回复于 2001-12-25 10:55:16 得分 0

我的email是:qbc0325@sina.com。Top

2 楼fei1995(三板斧)回复于 2001-12-25 10:57:18 得分 0

能发一份给我吗?  
  Fei2001@hotmail.comTop

3 楼wwwwwwww(我我)回复于 2001-12-25 11:01:31 得分 50

unit   Unit1;  
   
  interface  
   
  uses  
      Windows,   Messages,   SysUtils,   Classes,   Graphics,   Controls,   Forms,   Dialogs,  
      Psock,   NMsmtp,   StdCtrls;  
   
  type  
      TForm1   =   class(TForm)  
          Button1:   TButton;  
          NMSMTP1:   TNMSMTP;  
          Label1:   TLabel;  
          procedure   Button1Click(Sender:   TObject);  
          procedure   NMSMTP1Connect(Sender:   TObject);  
      private  
          {   Private   declarations   }  
      public  
          {   Public   declarations   }  
      end;  
  const   BaseTable:string='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';  
  var  
      Form1:   TForm1;  
      AuthSucc:boolean;//   是否需要密码验证  
      function   DecodeBase64(Source:string):string;   //解码函数  
      function   FindInTable(CSource:char):integer;     //  
      function   EncodeBase64(Source:string):string;   //编码函数  
   
  implementation  
   
  {$R   *.DFM}  
   
  procedure   TForm1.Button1Click(Sender:   TObject);  
  begin  
          NMSMTP1.Host   :='smtp.163.net';  
          NMSMTP1.Port   :=25;  
          NMSMTP1.UserID   :='lxh_0';  
          NMSMTP1.ReportLevel   :=1;  
          NMSMTP1.TimeOut   :=10000;  
          NMSMTP1.Connect;  
          if   AuthSucc=true   then   ////验证成功  
          begin  
                  //MailTo:=TStringList.Create;  
                  //MailTo.Add('cunmin1@163.net');  
                  //MailBody.Add('Hello   it   is   a   test');  
                  nmsmtp1.PostMessage.FromAddress:='lxh0@263.net';   //发信人的电子邮件地址  
                  nmsmtp1.PostMessage.ToAddress.Add('xcwang@ncu.edu.cn');  
                  nmsmtp1.PostMessage.Body.Text   :='test';  
                  nmsmtp1.PostMessage.Subject   :='My   test';  
                  nmsmtp1.SendMail;  
                  nmsmtp1.Disconnect;  
          end;  
   
  end;  
  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;  
   
  procedure   TForm1.NMSMTP1Connect(Sender:   TObject);  
  begin  
          label1.caption:=nmsmtp1.Status;  
      if   nmsmtp1.ReplyNumber   =   250   then  
          label1.caption:=nmsmtp1.Transaction('auth   login');   //开始认证  
      if   nmsmtp1.ReplyNumber   =334   then   //返回值为334,让你输入用BASE64编码后的用户名  
          label1.caption:=nmsmtp1.Transaction('lxh_0');//   用户名aaaaa  
      if   nmsmtp1.ReplyNumber   =334   then     //   返回值为334,让你输入用BASE64编码后的用户密码  
          label1.caption:=nmsmtp1.Transaction('141592');   //密码为123456  
      if   nmsmtp1.ReplyNumber   =235   then  
      begin  
          label1.caption:='successful';  
          AuthSucc:=true;  
      end;  
       
  end;  
   
  end.  
  Top

4 楼outer2000(天外流星)回复于 2001-12-25 11:07:32 得分 30

用D6里的INLY吧,没有那么多代码,呵呵。Top

5 楼sqq()回复于 2001-12-25 19:12:47 得分 0

谢了,最好的还是用D6里自带的clientmail.Top

6 楼sqq()回复于 2001-12-25 19:13:35 得分 0

给分了.Top

7 楼Nizvoo()回复于 2001-12-25 19:20:25 得分 0

Nizvoo@etang.comTop

8 楼cdchq(chq)回复于 2001-12-25 19:45:21 得分 0

关注……Top

9 楼Bellamy(酷公爵)回复于 2001-12-25 20:52:42 得分 0

呵呵Top

相关问题

  • 如何用PB6.5实现收发电子邮件
  • 怎样在局域网上用Exchange Server实现电子邮件的收发?????
  • 请高手指教如何使用delphi在程序中收发电子邮件
  • 那有vb收发电子邮件的原程序?最好不要使用exchange?
  • 高分配高手, 请问用FTP收发电子邮件的原理?
  • 收发电子邮件相关的api是什么,在那儿能找到,谢谢。
  • 能给我一份收发电子邮件的源代码吗?有附件功能的。
  • 怎么收发电子邮件?自己传pop3,smtp,端口等参数。不用CDO那一套
  • 电子邮件收发系统的界面设计中遇到的困惑(类似outlook)
  • 电子邮件

关键词

  • .net
  • nmsmtp
  • csource
  • postmessage
  • tform
  • tobject
  • sender
  • procedure
  • button
  • begin

得分解答快速导航

  • 帖主:sqq
  • wwwwwwww
  • outer2000

相关链接

  • Delphi类图书
  • Delphi类源码下载
  • Delphi控件下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo