各位大哥,小弟最近做了一个东东,要求用Delphi开发一个程序能收发E-mail,但小弟学浅,不知怎样得到邮箱服务器、用户名、密码什么的,小弟的邮箱有yahoo的也有gmail的,不知支持不支持呀?

解决方案 »

  1.   

    DELPHI 的 DEMO中有示范程序。
      

  2.   

    小弟看了粗看了Demo,但不知SMTP的服务器应该设置成哪里的,小弟用的是gmail的邮箱,
    假设 那么服务器是否可以写成mail.gmail.com   帐号写成aaaaa呢?
      

  3.   

    SMTP及POP3服务器,是有邮件提供商定义的。
      

  4.   

    有哪位高手帮我看看这个程序有什么问题,小弟急呀,谢了:
      try
        IdSMTP1.Host := 'SMTP.163.com';
        IdSMTP1.Username := '11111';
        IdSMTP1.Password := '11111';
        IdSMTP1.Port := 25 ;    IdMessage1.From.Address := '[email protected]';
        IdMessage1.Recipients.EMailAddresses:='[email protected]';
        IdMessage1.Subject:= '第一个邮件客户端';
        IdMessage1.Body.Text := Memo1.Text;
        if IdSMTP1.AuthSchemesSupported.IndexOf('LOGIN')>-1 then
        begin
          IdSMTP1.AuthenticationType := atLogin;
         // IdSMTP1.Authenticate;
        end;    IdSMTP1.Connect();//正常
        IdSMTP1.Send(IdMessage1);//弹出EIOProtocolReplyError异常 不知为什么?
      except
        IdSMTP1.Disconnect;
      end;
      

  5.   

    高人救我呀,今天要是不搞定我就just 毕了  
      

  6.   

    IdSMTP1.Username := '11111';
        IdSMTP1.Password := '11111';
    用户名:11111,密码:11111,
    你在163的账号?
    如果不是,先到163申请账号,再填写在这里,
      

  7.   

    我也刚写了一个发email的程序,现在出的一个问题就是有时能发,有时提示450错误。不知道为何。不过我用的是nmsmtp控件。
      

  8.   

    要用Base64编码,并且要用户名和密码:
    function EncodeBase64(const Source: string): string;
    const
      BaseTable = '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;procedure TForm1.NMSMTP1OnConnect(Sender: TObject);
    begin
      if NMSMTP1.ReplyNumber = 250 then NMSMTP1.Transaction('auth login');
      if NMSMTP1.ReplyNumber = 334 then
      begin
        NMSMTP1.Transaction(EncodeBase64(UserID));  //用户名比如: [email protected],就是abc
        NMSMTP1.Transaction(EncodeBase64(Password));//邮箱密码
      end;
    end;
      

  9.   

    to 楼主:
    有哪位高手帮我看看这个程序有什么问题,小弟急呀,谢了:
      try
        IdSMTP1.Host := 'SMTP.163.com';
        IdSMTP1.Username := 'caoyan_528'; //邮件的用户名,必须是真实的
        IdSMTP1.Password := 'pas'; //邮件的密码,必须是真实的
        IdSMTP1.Port := 25 ;    IdMessage1.From.Address := '[email protected]';
        IdMessage1.Recipients.EMailAddresses:='[email protected]';
        IdMessage1.Subject:= '第一个邮件客户端';
        IdMessage1.Body.Text := Memo1.Text;
        if IdSMTP1.AuthSchemesSupported.IndexOf('LOGIN')>-1 then
        begin
          IdSMTP1.AuthenticationType := atLogin;
         // IdSMTP1.Authenticate;
        end;    IdSMTP1.Connect();//正常
        IdSMTP1.Send(IdMessage1);//弹出EIOProtocolReplyError异常 不知为什么?
      except
        IdSMTP1.Disconnect;
      end;
      

  10.   

    多谢各位参与本讨论,小弟己经解决了发送电子邮件的问题,现在不知如何接收到内容,小弟用的是indy控件:
      IdPOP31.Connect();
      mailcount := IdPOP31.CheckMessages;
      for i:=1 to mailcount do
      begin
         IdMessage2.Clear;
         IdPOP31.retrieveHeader(i,IdMessage2);
         tmp := IdMessage2.Subject;
         Memo1.Lines.Add(tmp);
         tmp := IdMessage2.
         memo1.Lines.Add(IdMessage2.Body.Text); //内容为空,小弟想显示邮件内容
      end;
      IdPOP31.Disconnect;
    请问各位,如何才能下载到邮件的内容呀?