Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4118714
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:59:45+00:00 2026-05-20T22:59:45+00:00

Question: I would like to run an applescript against a list of selected messages

  • 0

Question: I would like to run an applescript against a list of selected messages in Apple OS X Mail.

Right now, the script I wrote will work on a single selection only, so I am guessing the issue is how to loop it for all items selected. Any help would be appreciated.

Here is the script:

tell application "Mail"

set theSelection to selection
set theSelectedMessage to item 1 of theSelection
set theSelectedMessageSender to sender of theSelectedMessage
set theSelectedMessageRecipient to address of to recipients of theSelectedMessage
set theSelectedMessageSenderName to extract name from sender of theSelectedMessage
set theSelectedMessageSenderAddress to extract address from sender of theSelectedMessage
set theSelectedMessageSubject to subject of theSelectedMessage
set theSelectedMessageContent to content of theSelectedMessage


set MessageText to ¬
"This email (" & theSelectedMessageRecipient & ") does NOT ¬
care to receive emails regarding this matter." & return & return & ¬
"This email was originally delivered to: " & ¬
theSelectedMessageRecipient & return & return & ¬
"Remove this email from your list: " & ¬
theSelectedMessageRecipient & ¬
return & return & ¬
"---------- ORIGINAL MESSAGE ----------------"

set theMessage to make new outgoing message with properties {visible:true, subject:"REMOVE: RE:" & theSelectedMessageSubject, content:MessageText & theSelectedMessageContent, reply to:theSelectedMessageRecipient}
tell theMessage
    make new to recipient at end of to recipients with properties {name:theSelectedMessageSenderName, address:theSelectedMessageSenderAddress}
end tell
end tell
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T22:59:46+00:00Added an answer on May 20, 2026 at 10:59 pm
    set theSelectedMessage to item 1 of theSelection
    

    Replace this with:

    repeat with theSelectedMessage in theSelection
    

    Just before the last line, add:

    end repeat
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to ask a question. Now i am training in iOS with
I asked the question here and now i would like to reverse this procedure
Question 1 We would like to generate a site map for our CMS site
I would like to ask a question on theming in liferay. What would be
This question would probably apply equally as well to other languages with C-like multi-line
I would like to start a community discussion. As per my question, when do
I would like to ask a rather, general, high-level introductory kind of question regarding
I saw this question asked about C# I would like an answer for PHP.
Im Making a question for a website and would like the the correct /
I found this question that is discussing what I would like to do, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.