我要实现的是按一个按钮 然后往Edit里面写的地址发送在另一个文本框里面编写好的内容邮件,
谁有例子程序。。
或怎么实现。。有什么更好的。。
希望大家帮帮我
谢谢

解决方案 »

  1.   

    var
      IdMessage1: TIdMessage;
      IdSASLLogin1: TIdSASLLogin;
      IdSMTP1: TIdSMTP;
      LHlogin: TIdUserPassProvider;
    begin
      result:=0;
      idMessage1:=TIdMessage.Create();
      IdSASLLogin1:=TIdSASLLogin.Create();
      IdSMTP1:=TIdSMTP.Create();
      LHlogin:=TIdUserPassProvider.Create();
      with idMessage1 do
      begin
        ContentType:='text/html';
        Body.LoadFromFile(STRfname);
        From.Address:=STRfromEMail;
        Recipients.EMailAddresses:=STRReEmail;
        IDMessage1.Subject:=STRsubject;
      end;
      with IDSMTP1 do
      begin
        Host:=STRHost;
        port:=INTport;
        username:=STRusername;
        password:=STRpassword;
        LHlogin.Username:=STRuserName;
        LHlogin.Password:=STRpassWord;
        IDSMTP1.AuthType:=atSASL;
        IDSMTP1.SASLMechanisms.Add.SASL:=IdSASLLogin1;
        IdSASLLogin1.UserPassProvider:=LHlogin;
      end;    try
          idsmtp1.Connect;
          idsmtp1.Authenticate;
          idsmtp1.Send(idMessage1);
          idsmtp1.Disconnect;
          result:=1;
        finally
         idMessage1.Free;
         IdSASLLogin1.Free;
         IdSMTP1.Free;
         LHlogin.Free;
        end;
     
    end;Delphi2007+indy10 环境
      

  2.   

     能不能告诉我
    IdMessage1: TIdMessage; 
      IdSASLLogin1: TIdSASLLogin; 
      IdSMTP1: TIdSMTP; 
      LHlogin: TIdUserPassProvider;这些具体要引用什么单元呢》??我不知道怎么弄谢谢