我使用NMSMTP和NMPOP3控件进行开发,但是使用NMSMTP时发邮件,总发生错误,提示
553 You are not authorized to Send from Mail ?
 在使用NMPOP3时收到的邮件是乱码?请问如何处理?

解决方案 »

  1.   

    出现“553 You are not authorized to Send from Mail ?”是你的邮箱发邮件时需要密码验证。NMPOP3时收到的邮件是乱码,需要对编码进行处理。
      

  2.   

    cneast(东东) :
      你好,能否指明怎样解决这个密码验证问题,我也给这个问题困住了。
      期待你的指点。
      

  3.   

    SMTP的OnConnectprocedure TForm1.SMTPConnect(Sender: TObject);
    begin
      if smtp.ReplyNumber = 250 then
        label1.caption:=smtp.Transaction('auth login'); //开始认证
      if smtp.ReplyNumber =334 then //返回值为334,让你输入用BASE64编码后的用户名
        label1.caption:=smtp.Transaction(EncodeBase64('你的用户名'));// 用户名
      if smtp.ReplyNumber =334 then  // 返回值为334,让你输入用BASE64编码后的用户密码
        label1.caption:=smtp.Transaction(EncodeBase64('你的密码')); //密码
    end;function EncodeBase64(Source:string):string;
    const BaseTable:string='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; 
    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; 
      

  4.   

    cneast(东东) :
       谢谢你。非常感谢你的指点.
      

  5.   

    163。com的邮箱经常出现各种各样的问题,建议别用。