----- Original Message -----
From: <[EMAIL PROTECTED]>

> In the past I saw a script that would read a POP mailbox
> waiting for a command to it.  It was smart enough to not
> rexecute the same command more than once.  If the command
> was not to it, it didn't do any thing at all with the
> message.
>


I think this is the one you are referring too. The remote email agent?

It's part of the Webtechniques Rebol Bot article Carl wrote. The article is
at

http://www.webtechniques.com/archives/1999/09/junk/



REBOL [Title: "Remote Email Agent"]

   users: [[EMAIL PROTECTED] [EMAIL PROTECTED]]
   password: "pass-email"
   stop-time: now + 12:00
   prior-len: 0

   do-ops: func [ops user mailbox /local action] [
      foreach [op arg] ops [
         action: select [
            forward [
               if string? arg [
                  foreach mail mailbox [
                     if find mail arg [send user mail]
                  ]
               ]
               if email? arg [
                  foreach mail mailbox [
                     msg: import-email mail
                     if arg = first msg/from [send user mail]
                  ]
               ]
            ]
            list [send user read arg]
            send [send user read arg]
            delete [delete arg]
            quit [quit]
         ] op
         either action [do action][
            send user join "bad op: " op
         ]
      ]
   ]

   while [now < stop-time] [
      mailbox: read pop://user:[EMAIL PROTECTED]

      foreach msg skip mailbox prior-len [
         msg: import-email msg
         from: first msg/from
         if all [
            find users from
            msg/subject = password
         ][
            ops: try [load msg/content]
            either error? ops [
               send from join "Error: " msg/content
            ][
               do-ops ops from mailbox
            ]
         ]
      ]
      prior-len: length? mailbox
      wait 0:10
   ]



Cheers

Allen K

Reply via email to