• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Vacation Mail script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Vacation Mail script


  • Subject: Vacation Mail script
  • From: Michelle Steiner <email@hidden>
  • Date: Sun, 26 Oct 2003 22:58:41 -0700

If mail.app had a rule to add people to the address book, and
especially to address book groups, it would be very easy to have a
Vacation rule that would send vacation notices only once to each
addressee. But because it doesn't have this feature (which was in
Claris Emailer 2.0, which was released seven and a half years ago), I
had to write a script to do it.

You have to have a address-book group titled "Vacation".

First set up a rule with the criteria "Sender is not a member of group
Vacation"

The actions are

Reply to message
Run Applescript

Here is the Applescript; it is *not* fully tested.

tell application "Mail"
perform mail action with messages messages_to_process for rule
"vacation"
repeat with message_to_process in messages_to_process
set the_sender to the sender of the message_to_process
my add_to_list(my parse_the_sender(the_sender))
end repeat
end tell

to add_to_list({FN, MN, LN, email_sender})
tell application "Address Book"
set the newbie to make new person at after the people of group
"Vacation" with properties {first name:FN, middle name:MN, last
name:LN}
make new email at after the emails of the newbie with properties
{label:"Vacation", value:email_sender}
save addressbook
end tell
end add_to_list

to parse_the_sender(sender_string)
set {tid, text item delimiters} to {text item delimiters, {"<"}}
set {sender_name, email_sender} to text items of the_sender
set text item delimiters to tid
set email_sender to text 1 through -2 of sender_email
set {FN, MN, LN} to {first word of sender_email, "", last word of
sender_email}
if count (words_of_names) is greater than 2 then
set MN to the second word of sender_email
end if
return {FN, MN, LN, email_sender}
end parse_the_sender

The script makes a rash assumption that the sender's name has two or
three words, and that the last word is the person's last name, and not
a suffix (such as "Jr."), that the first word is the person's first
name, and not a prefix (such as "Dr."). Any words between the third
and next-to-last are ignored, and if the name has only one word, it
will be used as the first and last names.

--
"The optimist proclaims that this is the best of all possible worlds ;
and the pessimist fears this is true." --James Branch Cabell
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: RE: Changing case to lower case in QuarkXPress v5
  • Next by Date: Re: SOAP calls on Panther?
  • Previous by thread: Re: SOAP calls on Panther?
  • Next by thread: Scrolling through records in filemaker
  • Index(es):
    • Date
    • Thread