Well, I'm sure you'll get lots of other responses but I'm in an email
mode so I'll get you going...

pop: open pop://email:[EMAIL PROTECTED]

That'll open up the pop mailbox.  At this point, pop is just like any
other block in REBOL except that the items in it are now the email
messages that are in your mailbox.  So you can do things like this:

length? pop ; how many messages are there?
print first pop ; print the first message
print last pop ; print the last message

probe msg: import-email first pop ; import the a message into an
object

either in msg 'reference [print ["Reference:" msg/reference] [print
   "No reference"] ; print the reference if there is one

!! The follwing are permanent !!
'remove pop' will delete the message that you can read with 'print
first pop' from the mailbox -- this is permanent!!
'clear pop' will delete all messages from the current pop location on
  This will empty the mailbox if pop is at the head - 'head? pop'

? send ; for info on the send function to send mail

and throw in a loop like FOR, FOREACH, or FORALL, and... watch out!
You're almost done!

Sterling

> Hi Rebols !
> 
> I'm brand new to this language/philosophy but it looks real promising.
> I'm definetly going to learn this...
> I've got a concrete exercise that I want to solve using rebol so that I can
> learn quicker.
> I guess I'm hoping somebody will help a beginner get off to a flying start.
> 
> So here goes ...
> 
> I have mail going to a specific user called "email" that contains a header
> field called "reference:"
> This "reference" field contains the email address of the intended recipient.
> I'd like to read this field, parse the email address and resend the email
> to this new address (including the message body of course).
> The message should then be deleted from "emails" mailbox.
> 
> I need to check the "email" mailbox (say every 5 minutes) to see if any new
> messages have arrived and forward them to the "real" intended recipient.
> 
> Here is an example mailbox file belonging to "email"
> 
> <----Mailbox------ START ---->
> 
> >From [EMAIL PROTECTED]  Wed May 31 16:25:54 2000
> Return-Path: <[EMAIL PROTECTED]>
> Delivered-To: [EMAIL PROTECTED]
> Received: from mailer1.mydomain.com
>  by mailf.mydomain.com (Postfix) with SMTP id BC2B11FA0A
>  for <[EMAIL PROTECTED]>; Wed, 31 May 2000 16:25:54 +0200 (CEST)
> Received: from mailer1.mydomain.com with TCP; Wed, 31 May 2000 16:19:43
> +0000
> Date:  Wed, 31 May 2000 16:19:43 +0000
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject:  Testmail 1
> Reference:  [EMAIL PROTECTED]
> Message-Id: <[EMAIL PROTECTED]>
> 
> 
> Body Text for email 1.
> 
> 
> 
> 
> >From [EMAIL PROTECTED]  Wed May 31 16:26:28 2000
> Return-Path: <[EMAIL PROTECTED]>
> Delivered-To: [EMAIL PROTECTED]
> Received: from mailer1.mydomain.com with TCP; Wed, 31 May 2000 16:20:17
> +0000
> Date:  Wed, 31 May 2000 16:20:17 +0000
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject:  testmail 2
> Reference:  [EMAIL PROTECTED]
> Message-Id: <[EMAIL PROTECTED]>
> 
> 
> Body Text for email 2.
> 
> 
> 
> 
>   <----Mailbox------ END ---->
> 
> 
> I realise this is probably trivial - REBOL can obviously do powerful things
> with a few lines of code.
> I've read the manuals and looked at the library examples regarding mail but
> can't
> seem to get started properly (sigh .. so much to learn, so fast ...)
> 
> regards
> 
> Simon
> 
> 
> 
> 

Reply via email to