• 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
Re: Set variable to contents of incoming message
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Set variable to contents of incoming message


  • Subject: Re: Set variable to contents of incoming message
  • From: John <email@hidden>
  • Date: Fri, 17 Aug 2012 12:41:52 -0400

Something like this would work ...


using terms from application "Mail"
    on perform mail action with messages theMessages for rule theRule
       
        repeat with aMessage in theMessages
            tell application "Mail" to set myContent to content of aMessage
            -- insert your code
        end repeat
       
    end perform mail action with messages
end using terms from



On Fri, Aug 17, 2012 at 12:36 PM, Michelle Steiner <email@hidden> wrote:
On Aug 17, 2012, at 9:18 AM, Neil Laubenthal wrote:

When/if you finish modifying Michelle's suggestion; please post with your final script, rule, and what you are doing with the info once you get it to the file. As cyclemeter user myself I'm happy to borrow other people's efforts to help with the logging/analysis process.

Turns out that Apple provides a template for mail actions; I extracted the part for message content, but have not tested it.

using terms from application "Mail"
on perform mail action with messages these_messages for rule this_rule
tell application "Mail"
set the message_count to the count of these_messages
repeat with i from 1 to the message_count
set this_message to item i of these_messages
try
set this_content to (every character of content of this_message) as Unicode text
if this_content is in {"", "?"} then error
on error error_message
set this_content to "NO CONTENT"
end try
end repeat
end tell
end perform mail action with messages
end using terms from

-- Michelle

-- 
"Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed."
President Dwight D. Eisenhower, April 16, 1953


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Set variable to contents of incoming message (From: Tony Bennett <email@hidden>)
 >Re: Set variable to contents of incoming message (From: Neil Laubenthal <email@hidden>)
 >Re: Set variable to contents of incoming message (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: Set variable to contents of incoming message
  • Next by Date: Mountain Lion Mail Rules Problems
  • Previous by thread: Re: Set variable to contents of incoming message
  • Next by thread: Re: Set variable to contents of incoming message
  • Index(es):
    • Date
    • Thread