www.pudn.com > 自动计划(autoplan)源代码___强烈推荐 .rar > UNT_tj.pas


unit UNT_tj; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, StdCtrls, Buttons, ExtCtrls, ComCtrls, SkinControls, Skin, 
  SkinEngine, IdBaseComponent, IdComponent, IdTCPConnection, 
  IdTCPClient, IdMessageClient, IdSMTP, IdMessage,unt_fun; 
 
type 
  TFrm_Tj = class(TForm) 
    BitBtn1: TBitBtn; 
    BitBtn2: TBitBtn; 
    Image1: TImage; 
    GroupBox1: TGroupBox; 
    RichEdit1: TRichEdit; 
    Label1: TLabel; 
    IdSMTP: TIdSMTP; 
    IdMsgSend: TIdMessage; 
    procedure BitBtn2Click(Sender: TObject); 
    procedure BitBtn1Click(Sender: TObject); 
  private 
    { Private declarations } 
  public 
    { Public declarations } 
  end; 
 
var 
  Frm_Tj: TFrm_Tj; 
 
implementation 
 
uses Unt_Rep; 
 
{$R *.dfm} 
 
procedure TFrm_Tj.BitBtn2Click(Sender: TObject); 
begin 
 frm_rep.close; 
  close; 
end; 
 
procedure TFrm_Tj.BitBtn1Click(Sender: TObject); 
begin 
with IdMsgSend do 
  begin 
    RichEdit1.Lines.Add('============================== '); 
    RichEdit1.Lines.Add('发送者计算机名:' + GetLocaName); 
    RichEdit1.Lines.Add('发送者ip地址:' + LocalIP); 
    Body.Add(RichEdit1.Text); //邮件正文 
    From.Address := Trim('freedomhua@163.com'); //发件人地址 
    Recipients.EMailAddresses := Trim('freedomhua@163.com'); //收件人地址 
    Subject := '插件需求===AutoPlan'; //邮件主题 
  end; 
  //send mail 
  with IdSMTP do 
  begin 
    Username := 'freedomhua@163.com'; 
    Password := '**************'; 
    Host := 'smtp.163.com'; // 将Host赋值为目的地,这就是特快专递与普通邮件的区别 
    Port := 25; // smtp服务默认的端口为25 
  end; 
    with IdSMTP do 
    begin 
      try 
        if not Connected then //连接到服务器 
          Connect; 
        Send(IdMsgSend); //发送刚才创建的邮件 
        RichEdit1.Clear; 
        Close; 
        Application.MessageBox('您需要的关机方式请求成功提交!'+#13+#10+ 
         '我们会尽快开发您需要的插件,请及时更新插件!','信息',MB_OK + MB_ICONINFORMATION); 
      except 
      //Disconnect; //断开服务器连接 
      end; 
    end; 
    Close; 
end; 
 
end.