On 7/12/04 8:17 am, "Scott Haneda" <[EMAIL PROTECTED]> wrote:

> on 12/7/04 12:02 AM, Scott Haneda at [EMAIL PROTECTED] wrote:
> 
>> I have a web form that will be sending me emails that contain a single email
>> address in the body, I want to somehow automate the process of getting that
>> email address into a group, how can I do this?
> 
> I should mention, the subject has a passcode in it, that is how the script
> can identify these emails from others.

OK, identifying the mail is easy - do that with a rule.

Then, where in the body does the email address appear? You could parse the
whole mail looking for it, but that is less certain than extracting it from
a known location.

This will extract the address, but I don't guarantee it's accuracy on all
addresses, especially if they contain non-ascii charcacters:


set thebody to "blah blah blah blah blah blah
blah blah blah blah blah. blah blah blah <[EMAIL PROTECTED]>
blah blah blah blah blah "
set AppleScript's text item delimiters to {"@"}
set theBits to text items of thebody
set theAddress to {get last word of item 1 of theBits, get first word of
item 2 of theBits} as string

Now, you need to add that address to a group.

Assuming the group already exists, you can access it by calling for:
    group "group_name"

A group has an element called 'group entries' that hold the email addresses
for that group. The group entry is a class, with only one property - the
'content' which holds the email address of that entry (as unicode text). The
dictionary lists this 'content' as 'read only', but like many read only
properties, it can be set at creation time. So,
    
    make new group entry at end of group "test group" �
        with properties {content:theAddress}

Will do what you want. It would be worth putting in a check to see if
'theaddress' already exists within the group before adding it again, or you
could end up with several duplicates if people submit the form more than
once (as they are wont to do!).

I hope this helps you on your way. Sing out for more assistance if needed.


-- 
Barry Wainwright
Microsoft MVP (see http://mvp.support.microsoft.com for details)
Seen the All-New Entourage Help Pages? - Check them out:
        <http://www.entourage.mvps.org/>


--
To unsubscribe:
<mailto:[EMAIL PROTECTED]>
archives:
<http://www.mail-archive.com/entourage-talk%40lists.letterrip.com/>
old-archive:
<http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>

Reply via email to