一点思路也没有,看过曾经的贴子,都是使用INDY但是我对编写邮件程序还没有全局的认识,看了DEMO没有看懂,请大虾帮忙,能不能提供一下简单的说明。

解决方案 »

  1.   

    http://hubdog.csdn.net/Download/dlIndex.htm
    基于Indy的Email发送组件源码
      

  2.   

    http://delphijl.99898.com/delphier/article/ShowArticle.asp?ArticleID=9
    用Delphi编写邮件特快专递程序 http://www.indyproject.org/indy/demodownloads/I9D6_Demos_24Nov02.zip
    如何用INDY控件制作邮件发送接收程序(需要身份验证的)
      

  3.   

    这是我昨天试验的的,都成功了,但是还需要考虑邮件群发的问题,以下是我昨天的试验代码,你可以参考以下.可以的话不要忘了分呀
    用Delphi7上控件 TidMessage,TidSMTP来发送电子邮件(编写:雨中太阳):
    定义变量
      UserEmail:string;//收件人邮件地址
      SmtpAuthType:integer;//验证
      SmtpServerUser:string;//登陆SMTP服务器的用户名
      SmtpServerPassword:string;//登陆SMTP服务器用到的密码
      SmtpServerName:string;//SMTP服务器名.例如:smtp.sohu.com
      SmtpServerPort:integer;//SMTP服务器端口,默认的是25
    以下是发送过程.其中idMsgSend:TidMessage,SMTP:TidSMTP;分别在Indy Clients和Indy Misc页上.
    procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
       with IdMsgSend do
          begin
             Body.Assign(Memo1.Lines);
             From.Text := '[email protected]';                         //发件人
             ReplyTo.EMailAddresses :=UserEmail ;
             Recipients.EMailAddresses :=UserEmail; { To: header }//收件人地址
             Subject := 'kkkkkkkkkkk'; { Subject: header } //邮件主体
    //         Priority := TIdMessagePriority(cboPriority.ItemIndex); { Message Priority } //邮件优先级
    //         CCList.EMailAddresses := edtCC.Text; {CC}           //抄送
    //         BccList.EMailAddresses := edtBCC.Text; {BBC}        //暗送
             if chkReturnReciept.Checked then                    //需要已读回执
                begin {We set the recipient to the From E-Mail address }
                   ReceiptRecipient.Text := From.Text;
                end
             else
                begin {indicate that there is no receipt recipiant}
                   ReceiptRecipient.Text := '';
                end;
          end;  authentication settings                 //是否需要验证
       case SmtpAuthType of
          0: SMTP.AuthenticationType := atNone;
          1: SMTP.AuthenticationType := atLogin; {Simple Login }
       end;  
       SMTP.Username := SmtpServerUser;
       SMTP.Password := SmtpServerPassword;   {General setup}
       SMTP.Host := SmtpServerName;
       SMTP.Port := SmtpServerPort;   {now we send the message}
       SMTP.Connect;
      
       try
          SMTP.Send(IdMsgSend);
          showmessage('发送成功!');
       finally
          
          SMTP.Disconnect;
          showmessage('发送失败!');
       end;
    end;
    以下是接收的部分代码:procedure TForm2.BitBtn1Click(Sender: TObject);//发送
    begin
        if POP.Connected then
        begin
            POP.Disconnect;
        end;
        POP.Host:=Pop3ServerName;
        POP.Port:=Pop3ServerPort;
        POP.Username:=Pop3ServerUser;
        POP.Password:=Pop3ServerPassword;
        POP.Connect;
        FMsgCount:=POP.CheckMessages;
        FMailBoxSize:=POP.RetrieveMailBoxSize div 1024;
        if FMsgCount>0 then
        begin
            RetrievePOPHeaders(FMsgCount);
        end else Label1.Caption:='没有邮件!';
    end;procedure TForm2.RetrievePOPHeaders(inMsgCount: integer);//接收主题
    var
        stTemp:string;
        intIndex:integer;
        itm:TListItem;
    begin
        stTemp:=Statusbar1.Panels[1].Text;
        lvHeaders.Items.Clear;
        for intIndex:=1 to inMsgCount do
        begin
            Application.ProcessMessages;
            Msg.Clear;
            POP.RetrieveHeader(intIndex,Msg);
            itm:=lvHeaders.Items.Add;
            itm.ImageIndex:=0;
            itm.Caption:=Msg.Subject;
            itm.SubItems.Add(Msg.From.Text);
            itm.SubItems.Add(DateToStr(Msg.Date));
            itm.SubItems.Add(IntToStr(POP.RetrieveMsgSize(intIndex)));
            itm.SubItems.Add('n/a');
        end;end;procedure TForm2.BitBtn2Click(Sender: TObject);//断开连接
    begin
        if POP.Connected then
        begin
            try
                POP.Reset;
            except
            end;
            POP.Disconnect;
        end;
    end;