哪位有没有本地邮箱收发程序的源码或例子,类似于FOXMAIL或OUTLOOK,谢谢~

解决方案 »

  1.   

    Delphi好像自带的例子就有啊,POP SMTP 应该很简单// 发送邮件到客服
    function TWagerList.SendMail(FromAddr, MyPassword, ToAddr,AttachmentPath,SubjectName:string): boolean;
    var
     FileName : String;
     msg_send : TIdMessage;
     IdSMTP   : TIdSMTP ;
    begin
    Try
      Result := False;
      msg_send := TIdMessage.Create(nil);
      IdSMTP   := TIdSMTP.Create(nil);
      
      FileName := AttachmentPath;
        if not FileExists(FileName) then
         exit;  //封装邮件体
      msg_send.Sender.Address := FromAddr;
      msg_send.From.Text    := FromAddr;  //设置收件人
      msg_send.Recipients.Add;
      msg_send.Recipients.Items[0].Address := ToAddr;
      msg_send.Recipients.Add;
      msg_send.Recipients.Items[1].Address := FromAddr;
      msg_send.Subject      := SubjectName;  //添加附件
      TIdAttachment.Create(msg_send.MessageParts, FileName);  //连接服务器,发送邮件
      with  IdSMTP do
        begin
          Host := 'mail.163.net';
          Port := 25;
          AuthenticationType := atLogin;
          UserName := FromAddr;
          PassWord := MyPassword;
          try
            Connect;
            Send(msg_send);
            //deletefile(FileName);
            Disconnect;
            Result := True;
          except
            //Application.MessageBox(pchar('上传数据不成功,可能是网络无法连接远程服务器'), '上传数据', MB_OK + MB_ICONQUESTION);
            Result := False;
            Disconnect;
          end;
            
            //Application.MessageBox(pchar('上传数据成功.'), '上传数据', MB_OK + MB_ICONINFORMATION);
        end;
     Finally
        msg_send.Free;
        IdSMTP.Free;
     end;end;
      

  2.   

    谢谢~不过想做的不仅仅是SMTP发送,除此以外还有POP3/MAP4收取,邮件存储等完整功能的一个独立邮件终端。
      

  3.   

    delphi盒子,里边有个类似FOXMAIL的源码。记不得名字了。
    EMail idMSTP TMail200 idPOP3 xml
    EMail 收发系统
      

  4.   

    OUTLOOK版的:unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, IdMessage, IdBaseComponent, IdComponent,DateUtils,
      IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP;type
      TForm1 = class(TForm)
        IdSMTP1: TIdSMTP;
        IdMessage1: TIdMessage;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    begin
      try
        IdSMTP1.Host:='172.20.100.21';
        IdSMTP1.Username:='jufei';
        IdSMTP1.Password:='1234';
        IdSMTP1.Port:=25;
        IdSMTP1.AuthenticationType:=atLogin;
        IdSMTP1.Connect;
        IdMessage1.Recipients.EMailAddresses:='[email protected]';
        IdMessage1.From.Address:='[email protected]';
        IdMessage1.Subject:='Love mail';
        IdMessage1.Body.Text:='Dear Wife,'+#13#10+'       If you receive this Email,That is what I miss you......'+#13+#13+'Success_ju'+#13+formatdatetime('yyyy/mm/dd',Now);
        IdSMTP1.Authenticate;
        IdSMTP1.Send(IdMessage1);
        ShowMessage('@_@發送成功!');
        IdSMTP1.Disconnect;
      except
        IdSMTP1.Disconnect;
        Showmessage('@^^@發送失敗!');
        Exit;
      end;
    end;end.
      

  5.   

    再加個格式好看點...unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, IdMessage, IdBaseComponent, IdComponent,DateUtils,
      IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP;type
      TForm1 = class(TForm)
        IdSMTP1: TIdSMTP;
        IdMessage1: TIdMessage;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    begin
      try
        IdSMTP1.Host:='172.20.100.21';
        IdSMTP1.Username:='jufei';
        IdSMTP1.Password:='1234';
        IdSMTP1.Port:=25;
        IdSMTP1.AuthenticationType:=atLogin;
        IdSMTP1.Connect;
        IdMessage1.Recipients.EMailAddresses:='[email protected]';
        IdMessage1.From.Address:='[email protected]';
        IdMessage1.Subject:='Love mail';
        IdMessage1.Body.Text:='Dear Wife,'+#13#10+'       If you receive this Email,That is what I miss you......'+#13+#13+'Success_ju'+#13+formatdatetime('yyyy/mm/dd',Now);
        IdSMTP1.Authenticate;
        IdSMTP1.Send(IdMessage1);
        ShowMessage('@_@發送成功!');
        IdSMTP1.Disconnect;
      except
        IdSMTP1.Disconnect;
        Showmessage('@^^@發送失敗!');
        Exit;
      end;
    end;end.