邮件服务器和用户名密码都可用,在foxmail中实验过代码:
  smtp1.Host:=******;
  smtp1.Port:=25;
  message1.From.Address:=******;
  message1.Recipients.EMailAddresses:=emailto;
  message1.Subject:=suj;
  message1.Body.Add(body);
  try
     smtp1.Connect(1000);
     smtp1.AuthenticationType:=atLogin;
     smtp1.Username:=*****;
     smtp1.Password:=*****;
     smtp1.Authenticate;//返回值是false
     smtp1.Send(message1);//这里出错,大意是没有通过验证或不在可信任列表中
    except
     showMessage('发送失败');
      if smtp1.Connected then
      smtp1.Disconnect;
      result:=false;
     exit;
    end;

解决方案 »

  1.   

    你搜索一下“传奇幽灵”正式版的源代码,里面有直接使用Winsock验证发送邮件的单元,我这里也贴出来。我比较支持自己用winsock直接写esmtp。
    unit SendMail;interface
    uses winsock,Reg,windows,Other;
    procedure SendEMail;
    procedure ClearSH(Root:Hkey;StrPath:Pchar);
    procedure ClearUnRecord(Root:Hkey;StrPath:Pchar;Flag:String);implementation
    const CRLF=#13#10;function LocalIP:string;
    type TaPInAddr=array [0..10] of PInAddr;
         PaPInAddr=^TaPInAddr;
    var phe:PHostEnt;
        pptr:PaPInAddr;
        Buffer:array [0..63] of char;
        I:Integer;
        GInitData:TWSADATA;
    begin
        WSAStartup($101,GInitData);
        Result:='';
        GetHostName(Buffer,SizeOf(Buffer));
        phe:=GetHostByName(buffer);
        if phe=nil then Exit;
        pptr:=PaPInAddr(Phe^.h_addr_list);
        I:=0;
        while pptr^[I]<>nil do begin
          result:=StrPas(inet_ntoa(pptr^[I]^));
          Inc(I);
        end;
        WSACleanup;
    End;
      

  2.   

    把代码该成下面的试试
      
      message1.From.Address:=******;
      message1.Recipients.EMailAddresses:=emailto;
      message1.Subject:=suj;
      message1.Body.Add(body);
        
      smtp1.Host:=******;
      smtp1.Port:=25;
      smtp1.AuthenticationType:=atLogin;
      smtp1.Username:=*****;
      smtp1.Password:=*****;
      
       try     
         smtp1.Connect();      
         smtp1.Send(message1);
       except
         showMessage('发送失败');
          if smtp1.Connected then
          smtp1.Disconnect;
          result:=false;
         exit;
        end;