d
有相关的例子请贴一个,或发到[email protected]
我是初学者谢谢

解决方案 »

  1.   

    去盒子论坛搜索下 很多的 
     www.2ccc.com 养成自己动手的好习惯
      

  2.   

    demo里有,自己去看看吧。或者找本书,都有源码实例。
    我做过的,比较简单。
      

  3.   

    网上的代码都是书上抄的例子。简单但实际过程中遇到问题很多,所以想看看一成熟的程序处理方法
    比如解码等,我还没找到一个可以解我现有邮箱中所有错码的算法。
    还有就是接收邮件时有什么方法可以不下载邮件整体,只下载指定的部分如标题等
    我现在发现就算我只指定标题,他一样把附件也下载了,这样速度太慢还有就是现在发163.com时总是提示命令次序错误为什么我肯定不是什么也没做就上来发贴子的谢谢
      

  4.   

    1。邮件主题和正文内容解码--用以下代码解码就可以
    function   Tfrm_accept_mail.CheckTxt(s:string):   string;
      var
          s1,   s2,   s3:   integer;
          t,   v:   string;
          Encoding:   char;
          hex,   step:   integer;
          a1:   array[1..4]   of   byte;
          b1:   array[1..3]   of   byte;   
          j:   integer;   
          byte_ptr,   real_bytes:   integer;   
      begin   
          s1   :=   Pos('=?',   s);   
          s2   :=   1;   
          hex   :=   0;   
          if   s1   >   0   then   
          begin   
              for   s2   :=   Length(s)   -   1   downto   1   do   
              begin   
                  if   Copy(s,   s2,   2)   =   '?='   then   Break;   
              end;   
          end;   
          if   (s1   =   0)   or   (s2   =   1)   then   
          begin   
              Result   :=   s;   
              Exit;   
          end;   
          t   :=   Copy(s,   s1   +   2,   s2   -   2   -   s1);   
          s3   :=   Pos('?',   t);   
          Delete(t,   1,   s3);   
          if   (t   =   '')   then   
          begin   
              Result   :=   s;   
              Exit;   
          end;   
          Encoding   :=   t[1];   
          Delete(t,   1,   2);   
          v   :=   '';   
          step   :=   0;   
          case   Encoding   of   
              'Q':   
                  while   t   <>   ''   do   
                  begin   
                      case   step   of   
                          0:   
                              begin   
                                  case   t[1]   of   
                                      '_':   v   :=   v   +   '   ';   
                                      '=':   step   :=   1;   
                                  else   
                                      v   :=   v   +   t[1];   
                                  end;   
                              end;   
                          1:   
                              begin   
                                  if   t[1]   <=   '9'   then   
                                      hex   :=   (Ord(t[1])   -   Ord('0'))   *   16   
                                  else   
                                      hex   :=   (Ord(t[1])   -   55)   *   16;   
                                  step   :=   2;   
                              end;   
                          2:   
                              begin   
                                  if   t[1]   <=   '9'   then   
                                      hex   :=   hex   +   (Ord(t[1])   -   Ord('0'))   
                                  else   
                                      hex   :=   hex   +   Ord(t[1])   -   55;   
                                  v   :=   v   +   Chr(hex);   
                                  step   :=   0;   
                              end;   
                      end;   
                      Delete(t,   1,   1);   
                  end;   
              'B':   
                  begin   
                      byte_ptr   :=   0;   
                      for   j   :=   1   to   Length(t)   do   
                      begin   
                          Inc(byte_ptr);   
                          case   t[j]   of   
                              'A'..'Z':   a1[byte_ptr]   :=   Ord(t[j])   -   65;   
                              'a'..'z':   a1[byte_ptr]   :=   Ord(t[j])   -   71;   
                              '0'..'9':   a1[byte_ptr]   :=   Ord(t[j])   +   4;   
                              '+':   a1[byte_ptr]   :=   62;   
                              '/':   a1[byte_ptr]   :=   63;   
                              '=':   a1[byte_ptr]   :=   64;   
                          end;   
                          if   byte_ptr   =   4   then   
                          begin   
                              byte_ptr   :=   0;   
                              real_bytes   :=   3;   
                              if   a1[1]   =   64   then   real_bytes   :=   0;   
                              if   a1[3]   =   64   then   
                              begin   
                                  a1[3]   :=   0;   
                                  a1[4]   :=   0;   
                                  real_bytes   :=   1;   
                              end;   
                              if   a1[4]   =   64   then   
                              begin   
                                  a1[4]   :=   0;   
                                  real_bytes   :=   2;   
                              end;   
                              b1[1]   :=   a1[1]   *   4   +   (a1[2]   div   16);   
                              b1[2]   :=   (a1[2]   mod   16)   *   16   +   (a1[3]   div   4);   
                              b1[3]   :=   (a1[3]   mod   4)   *   64   +   a1[4];   
                              if   (real_bytes   >   0)   then   
                                  v   :=   v   +   chr(b1[1]);   
                              if   (real_bytes   >   1)   then   
                                  v   :=   v   +   chr(b1[2]);   
                              if   (real_bytes   >   2)   then   
                                  v   :=   v   +   chr(b1[3]);   
                          end;   
                      end;   
                  end;   
          end;   
          Result   :=   Copy(s,   1,   s1   -   1)   +   v   +   Copy(s,   s2   +   2,   999);   
      end;
      

  5.   

    2。问:接收邮件时有什么方法可以不下载邮件整体,只下载指定的部分如标题等
    答:请用IdPOP31.RetrieveHeader(MessageNum,Msg);这样正文和附件不会读取,速度快 不过在此我想请问楼主,我也在做邮件收发程序,我现在不知道怎么样把邮件正文和附件直接收到后就保存在数据库或者在本地,请指教。