对状态的监视部分我都写好了,也能知道设备的状态变化,就是不知道怎么让软件按管理员设置的email地址来发送这些信息了。

解决方案 »

  1.   

    你所说的这个问题,给一个思路,希望有写帮助:开发一个邮件系统.某一消息激活时便启动消息发送窗口,将相应的参数如mail address和要发送的消息分别写给该窗口相对控件的相应属性,如richedit.lines.add()----information
    edit.text------mail address
      

  2.   


    首先你的程序应该和系统的某个程序绑定,比如说Explore,这样才能实时监控
    其次,你加个触发时间就行了
    最后做你自动发送E-mail程序举个简单的例子
    监视IE窗口的打开,当IE窗口打开时,自动计时
    var
     iewindow:THandle;
    begin
      iewindow:=FindWindow('ieframe',nil);
      if iewindow<>nil then
       begin
        //add yourcode here
        Timer1.Enabled:=true;
        //如果你想发邮件可以试试下面的语句
       shellexecute(handle,nil,pchar('mailto:[email protected]'),nil,nil,sw_hide);
       end;
    end;
      

  3.   

    shellexecute(handle,nil,pchar('mailto:[email protected]'),nil,nil,sw_hide);这样好象只能呼叫默认的邮件发送软件,我想要的是能在没有用户参与的情况下给指定的邮件地址发送邮件。非常感谢。还请大家继续讨论。
      

  4.   

    在我们机房中我也做过这样的软件,比如UPS报警我会监控UPS的日志文件,发现报警就发mail给管理员,还可以通过手机短信发通知让管理员去检查邮件,这样晚上回家也没关系了。
    以下是相关代码:
    管理员的地址我放到了配置文件中,这样可以方便更改
    我们公司有自己的邮件服务器,我就用它来发送邮件,这样要可靠得多
    所以发邮件的错误校验什么我基本上没做
    你看一下吧,可能整理的不全,idmessage1和idsmtp1是indy的控件
    idmessage1.From.Text:='daemon<[email protected]>';
    idmessage1.ReceiptRecipient.Text:='daemon<[email protected]>';
    idmessage1.Recipients.EMailAddresses:=tf.ReadString('set','通知地址','');
    idmessage1.Subject:=datetimetostr(now())+'  UPS报告';
    idmessage1.body.clear;
    reset(tlog);//打开文件把内容读到idmessage1中
    while not eof(tlog) do
    begin
    readln(tlog,sa);
    idmessage1.Body.Add(sa);
    end;
    closefile(tlog);
    ok:=false;
    while not ok do
    begin
    try
    idsmtp1.disConnect;
    idsmtp1.Connect;
    idsmtp1.send(idmessage1);
    idsmtp1.disconnect;
    finally
    ok:=true;
    end;
    end;
      

  5.   

    NMSMTp1.Host := 'smtp.163.net';
        NMSMTp1.UserID := 'xxxx';
        NMSMTp1.PostMessage.FromAddress := '[email protected]';
        NMSMTp1.PostMessage.FromName := 'xxxx';
        NMSMTp1.PostMessage.ToAddress.Text := '[email protected]';
        NMSMTp1.PostMessage.Body.Text := 'Body';
        NMSMTp1.PostMessage.Subject := 'Subject';
        NMSMTp1.Connect;
        NMSMTp1.SendMail;
    这样写代码,老是提示我没有权限发送邮件。我一下子又找不到这个密码的属性,请大家帮忙。