The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus for iPad
FAQ Members List Calendar Today's Posts

 
Processing email on the iPad Thread Tools Search this Thread Display Modes
on notify_user(subject, sender, type)
tell application "GrowlHelperApp"
notify with name ¬
"ActionMail" title ¬
"Moving " & type description ¬
subject & " from " & sender application name "Growl ActionMail"

end tell
end notify_user

on notify_intent(account, size, type)
tell application "GrowlHelperApp"
notify with name ¬
"ActionMail" title ¬
"Intent for " & account description ¬
"Move " & size & " messages of type " & type application name "Growl ActionMail"

end tell
end notify_intent

on identify_inbox(theAccount, theInbox)
tell application "Mail"
tell account theAccount
mailbox theInbox
end tell
end tell
end identify_inbox

on identify_target_mailbox(theAccount, theTarget)
tell application "Mail"
if theAccount is "QUT" then
tell account theAccount
tell mailbox "Inbox"
return mailbox theTarget
end tell
end tell
end if
if theAccount is "MobileMe" then
tell account theAccount
return mailbox theTarget
end tell
end if
end tell
end identify_target_mailbox

on taskify_messages(theSelectedMessages)
tell application "Mail"
repeat with selected_message in theSelectedMessages

set message_id to the message id of the selected_message
set theSender to the sender of the selected_message
set theSubject to the subject of the selected_message
set fromBit to theSender & return
set message_url to "message://%3C" & message_id & "%3E"
set theBody to fromBit & return & the content of the selected_message
set theAttachments to every mail attachment of the selected_message

tell application "OmniFocus"
tell front document
set newTask to make new inbox task with properties {name:theSubject, note:theBody}
tell newTask
tell note
insert "Original Message" & return & return at before first character
set value of attribute "link" of style of paragraph 1 to message_url
repeat with theAtt in theAttachments
set theName to the name of theAtt
set myFilePath to "Macintosh HD:Users:simon:Desktop:" & theName
save theAtt in myFilePath
make new file attachment with properties {file name:myFilePath, embedded:true}
tell application "Finder"
delete file myFilePath
end tell
end repeat
end tell
end tell
end tell
end tell
my notify_user(theSubject, theSender, "Sent to OmniFocus")


end repeat
end tell
end taskify_messages


on move_messages(theAccount, moveList, sourceMailbox, targetMailbox, moveType)
tell application "Mail"
my notify_intent(theAccount, count of moveList, moveType)
if (count of moveList) is greater than 0 then
repeat with theMessage in moveList
tell account theAccount
if mailbox of theMessage is sourceMailbox then
set read status of theMessage to true
move theMessage to targetMailbox
set theSubject to the subject of theMessage
set theSender to the sender of theMessage
my notify_user(theSubject, theSender, moveType)
delay 1
end if
end tell
end repeat

delay 5
end if

end tell
end move_messages

on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning

on run
tell application "GrowlHelperApp"
set the allNotificationsList to {"ActionMail"}

register as application ¬
"Growl ActionMail" all notifications allNotificationsList ¬
default notifications allNotificationsList ¬
icon of application "Mail"

end tell

tell application "OmniFocus"
activate
delay 10
end tell


tell application "Mail"

if not my appIsRunning("Mail") then
tell application "Mail"
check for new mail
tell application "Mail"
repeat until background activity count = 0
delay 1
end repeat
end tell
end tell
end if

delay 2
with timeout of 90000 seconds

set myActionsBox to my identify_target_mailbox("MobileMe", "Action")
set mobilemeArchiveBox to my identify_target_mailbox("MobileMe", "Archive")

tell myActionsBox
set theMessages to every message
end tell

my taskify_messages(theMessages)

-- uncomment next line to actually move actioned messages to archive
my move_messages("MobileMe", theMessages, myActionsBox, mobilemeArchiveBox, "Moved to MobileMe")


delay 60

tell application "OmniFocus"
synchronize
end tell

end timeout
end tell
end run
 
Quote:
Originally Posted by endoftheQ View Post

It currently isn't possible to forward an email received on your iPhone or iPad to your Mail account for processing by the Omni Mail rule because Mail adds formatting to forwarded text (see 1st image) which the rule cannot handle (I'm unsure whether this is a limitation of Omni's rule or a restriction within OSX).
I do this every day (forward mail from iPhone and iPad for processing by the Omni Mail rule) with no trouble whatsoever. Just did it again to prove to myself that I'm not crazy.
 
Quote:
Originally Posted by sfkeydel View Post
I do this every day (forward mail from iPhone and iPad for processing by the Omni Mail rule) with no trouble whatsoever. Just did it again to prove to myself that I'm not crazy.
Hi sfkeydel,

I'm gobsmacked to hear you've succeeded where we've all failed! I'd love to know your secret. For further info. on the problems us mortals experience, check out this thread.

EDIT: I've just read through some other threads and it appears that some ISPs mail servers and some web mail services strip out the offending formatting. May I ask which mail service provider you're using?

EDIT: Just tested forwarding emails from my iPhone via my GoogleMail account and these do get processed. GoogleMail obviously strips out the offending formatting.

Last edited by endoftheQ; 2010-08-03 at 02:31 PM..
 
I use a text based email client most of the time and have never had a problem.

Are you using Plain Text in Mail.app or a weird email signature or something?
 
I use a couple: Gmail and MobileMe. Haven't had any trouble.

Stefan
 
Love the code! Processes a given mailbox to convert to Omnifocus tasks.

I updated the code:
- removed growl
- added a couple of parameters upfront
- added a simple script you can use to find out exact name of mailbox

Code:
(*
	SCRIPT: Convert emails in Mail Folder to Omnifocus Tasks
	updated 3 August 2010
	
	NOTE: to find out any given mailbox/mail folder, run this script:
	tell application "Mail"
		set firstMessageViewer to first message viewer
		set theSelection to selected mailboxes of firstMessageViewer
	end tell	
*)

--!! PROPERTIES BELOW DEFINE KEY VARIABLES !!--

-- Mail Account Name (see above for script to find out)
property boxAccount : "BK0001"

-- Mail Folder to check 
property box2Check : "Inbox/2-action"

-- Mail Folder to file after task created 
property box2File : "Inbox/9->OF"

on taskify_messages(theSelectedMessages)
	tell application "Mail"
		repeat with selected_message in theSelectedMessages
			
			set message_id to the message id of the selected_message
			set theSender to the sender of the selected_message
			set theSubject to the subject of the selected_message
			set fromBit to theSender & return
			set message_url to "message://%3C" & message_id & "%3E"
			set theBody to fromBit & return & the content of the selected_message
			set theAttachments to every mail attachment of the selected_message
			
			tell application "OmniFocus"
				tell front document
					set newTask to make new inbox task with properties {name:theSubject, note:theBody}
					tell newTask
						tell note
							insert "Original Message" & return & return at before first character
							set value of attribute "link" of style of paragraph 1 to message_url
							repeat with theAtt in theAttachments
								set theName to the name of theAtt
								set myFilePath to "Macintosh HD:Users:simonesktop:" & theName
								save theAtt in myFilePath
								make new file attachment with properties {file name:myFilePath, embedded:true}
								tell application "Finder"
									delete file myFilePath
								end tell
							end repeat
						end tell
					end tell
				end tell
			end tell
		end repeat
	end tell
end taskify_messages


on move_messages(theAccount, moveList, sourceMailbox, targetMailbox, moveType)
	tell application "Mail"
		if (count of moveList) is greater than 0 then
			repeat with theMessage in moveList
				tell account theAccount
					if mailbox of theMessage is sourceMailbox then
						set read status of theMessage to true
						move theMessage to targetMailbox
						set theSubject to the subject of theMessage
						set theSender to the sender of theMessage
						delay 1
					end if
				end tell
			end repeat
			
			delay 5
		end if
		
	end tell
end move_messages

on appIsRunning(appName)
	tell application "System Events" to (name of processes) contains appName
end appIsRunning

on run
	tell application "OmniFocus"
		activate
		delay 10
	end tell
	
	
	tell application "Mail"
		
		if not my appIsRunning("Mail") then
			tell application "Mail"
				check for new mail
				tell application "Mail"
					repeat until background activity count = 0
						delay 1
					end repeat
				end tell
			end tell
		end if
		
		delay 2
		with timeout of 90000 seconds
			
			set myActionsBox to mailbox box2Check of account boxAccount
			set myArchiveBox to mailbox box2File of account boxAccount
			
			tell myActionsBox
				set theMessages to every message
			end tell
			
			my taskify_messages(theMessages)
			
			-- uncomment next line to actually move actioned messages to archive
			my move_messages(boxAccount, theMessages, myActionsBox, myArchiveBox, "Moved to 9-sent to OF")
			
			
			delay 60
			
			tell application "OmniFocus"
				synchronize
			end tell
			
		end timeout
	end tell
end run
 
In wanting a way to have e-mail and/or attachments available on all three devices as reference material for my OmniFocus projects, I worked out the following method which has the advantage of keeping the mail and attachments from cluttering up the OmniFocus database and yet keeps it at hand and easily retrievable:

1) Create a dedicated folder in Mail. (I call mine @OmniReference).

2) Create a rule that automatically places incoming messages that contain a key phrase into that folder. (Again, I use @OmniReference).

3) Go ahead and mail yourself your reference documents, or forward entire e-mail messages back to yourself, but be sure to include the key word and a unique identifier. (For example, @OmniReference #ooo25). The identifier can really be anything that makes sense to you, so long as it is unique.

4) Create an item in your project with the title of the E-Mail, using @OmniReference as the context, and including the identifier either in the title or in the note section.

5) Now you have a clear reference to follow back to Mail, where you can open the message as it was originally sent to you (no formatting issues), or open your document using the "open in" function. (I like to open mine with GoodReader, but there are plenty of other good options out there as well).

This has worked very well for me. Just as I use iCal to draw my "lines in the sand", I use Mail to store my reference material.

I hope this might prove useful to others. I am sure that as OmniFocus continues to evolve, these workarounds will not be necessary, (although I am really liking the concept of keeping all that reference material in Mail and out of the OmniFocus database).

Best Regards,

Ralph
 
Quote:
Originally Posted by endoftheQ View Post

In our team we all use the same code to convert emails into actions. So, the client got my response and Jo, Lisa, Ciaran and myself got an action that dropped into our OmniFocus inboxes containing the email in the action's notes.
this sounds really interesting. i would like to give this a try. could you explain what you mean by 'the same code to convert emails into actions'
 
Quote:
Originally Posted by email68 View Post
Is there any way to turn emails into actions on the iPad similar to what you can do on the Mac?

Its a big part of my work flow.
There is a way to do this, though it is cumbersome (currently only one email at a time, and you need to constantly switch between apps - I have put a request in to automate this feature as background).

See this topic for more info:
http://forums.omnigroup.com/showthread.php?t=19420
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
Processing email into actions and completed date bike4life OmniFocus 1 for Mac 1 2012-11-09 10:37 AM
My way of processing email to OF on iPhone - inbox zero style (requires IMAP email) Casper TFG OmniFocus for iPhone 19 2010-04-18 01:40 PM
email processing inconsistent rllewis@mac.com OmniFocus 1 for Mac 0 2008-09-11 11:22 AM


All times are GMT -8. The time now is 10:08 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.