要求:能实现邮件发送就行,D6环境请将代码发到[email protected]
或写出下载地址。要源吗,带注解。看懂后结贴

解决方案 »

  1.   

    Fsend:Tidsmtp,femail:TIdMessage Fsend.Host :='smtp服务器地址';
     Fsend.Port :=25;
     FSend.Username :=      //发送信箱用户名
     FSend.Password :=      //密码
     Femail.Subject :=      //主题
     FEmail.Body.Text :=  //设置邮件内容
      FEmail.From.Text := ;  //设置发送邮箱地址
      FEmail.ReplyTo.Clear;
      FEmail.ReplyTo.Add.Text := ;   FEmail.Recipients.Clear;  
     Femail.Recipients.EMailAddresses := ;//设置接受邮箱地址 Femail.MessageParts.Clear;
     TIdAttachment.Create(Femail.MessageParts,附件完整路径);//添加附件try         //发送
       try
          Fsend.Connect;
          Fsend.Send(Femail);
       Except
          Fsend.DisconnectSocket ;
          Fsend.Disconnect ;
          application.MessageBox('连接SMTP服务器出现错误','错误',MB_ICONERROR);
          exit;
       end;
    finally
      Fsend.DisconnectSocket ;
      Fsend.Disconnect ;
    end;
      

  2.   

    我用的是DELPHI6没有 FSend.Username 属性
      

  3.   

    d6没有Tidsmtp,TIdMessage组件,用d7
      

  4.   

    d6中怎么没有
        IdSMTP1: TIdSMTP;
        IdMessage1: TIdMessage;还有,我用d6中demo下的MailClient程序,不行,发不出去,提示“software caused connection abort”
    但是收信可以,为什么??????????
      

  5.   

    不会吧, 我试过的,没有问题呀?不行你试试FastNet下的:
      Borland\Delphi6\Demos\FastNet\Smtp
      

  6.   

    ●●●●TO:zdq801104(我很笨,但是我不傻!你没看到我贴子的标题吗“求邮件发送的源码”你给我发个接收的有什么用?
    ●●●●TO:delphi99(delphi99) 
    Borland\Delphi6\Demos\FastNet\Smtp下的那个我试了,不行,出错,提示:“software caused connection abort”什么原因呀
      

  7.   

    function TFrmtime.SendEmail(eMail, eSubject, eBody: string): Boolean;
    var
      s_IniFile: Tinifile;
      s_Host, s_Mail_From,MailAddress: string;
      s_line, s_attch:string;
      s_file: textfile;
      s_SubMail: string;
    begin
      s_IniFile := TIniFile.Create(ExtractFilePath(Application.Exename)+'Send.ini');
      g_MailServer := s_IniFile.ReadString('Email','MailServer','');
      g_MailAccount := s_IniFile.ReadString('Email','MailAccount','');
      g_MailPWD := s_IniFile.ReadString('Email','MailPassword','');
      g_MailAddress := s_IniFile.ReadString('Email','MailAddress','');
      s_IniFile.Free;  Result := False;
      NMSmtp1.Host:= trim(g_MailServer);
      NMSmtp1.UserID:=trim(g_MailAccount);
      NMSMTP1.TimeOut:=20000;  if not NMSMTP1.Connected then
      try
        NMSMTP1.Connect;
      except
              showmessage('邮件连接失败!');
        Exit;
      end;  NMSmtp1.PostMessage.FromAddress:='';
      NMSmtp1.PostMessage.FromAddress:=trim(g_MailAddress);
      NMSmtp1.PostMessage.ToAddress.Clear;  while pos(';',eMail)>0 do
      begin
        s_SubMail := copy(eMail,1,pos(';',eMail)-1);
        NMSMTP1.PostMessage.ToAddress.Add(s_SubMail);
        delete(eMail,1,pos(';',eMail));
      end;
      if length(eMail)>1 then
        NMSMTP1.PostMessage.ToAddress.Add(eMail);  NMSmtp1.PostMessage.Subject:='';
      NMSmtp1.PostMessage.Subject:=trim(eSubject);
      NMSmtp1.PostMessage.Body.Clear;
      NMSMTP1.PostMessage.Body.Text:=trim(eBody);  try
       NMSmtp1.SendMail;
       Result := True;
      except
       Result := False;
      end;
      NMSmtp1.Disconnect;end;
      

  8.   

    我试了你的程序,还是那个错误“software caused connection abort”