|
|
#1 |
|
applescript to send new email
I am looking to generate a new email in response to email from twitter about a new follower. The twitter notification typically has the following format for the subject:
"Name (@twitter_username) is now following you on Twitter!" I am looking for a mail script which does the following:
I have a script which does all the above except extracting the username from the subject line. Here is the script on Pastebin Will appreciate any help to tweak it to add the username extracting feature! Thanks Last edited by juju01; Jan 20, 2013 at 05:39 PM. |
|
|
|
0
|
|
|
#2 |
|
One way of doing it would be something like this :
Code:
tell application "Mail"
set theMessages to every message of mailbox "INBOX" of account "GMX" whose subject contains "Twitter"
repeat with eachMessage in theMessages
set theSubject to subject of eachMessage
set thefirstoffset to offset of "(" in theSubject
set thesecondoffset to offset of ")" in theSubject
set twitter_username to characters (thefirstoffset + 1) thru (thesecondoffset - 1) of theSubject as string
set theNewMessage to make new outgoing message with properties {subject:"Notify", content:"Welcome new twitter follower" & space & twitter_username, visible:true}
tell theNewMessage
activate
make new to recipient at end of to recipients with properties {address:"email@someone.com"}
--send
end tell
end repeat
end tell
__________________
Space Corps Directive 34124 |
|
|
|
0
|
|
|
#3 | |
|
Quote:
Thank you! This looks great. The first line is a throwing me off a bit. I am using a mail rule to trigger the script to run - only when a new message arrives. So with this code, do I use this in a mail rule ? Does the code above fire only when new messages arrive for the specified mail account? - which is what I want to do. Thanks again. |
||
|
|
0
|
|
|
#4 |
|
Unfortunately I hardly use Mail nor do I use Twitter so I had to send myself a few mails with the subject line you mentioned to test on. The first line was used to get me a list of message ids from a specific mailbox and account to work with and isn't needed when using a rule.
__________________
Space Corps Directive 34124 |
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 04:05 PM.







Linear Mode
