Applescript to move incoming mail to a folder

I use IMAP to read mail from different devices, I wish to keep an archive on one computer.
Rule for incoming message moves unread message just fine, but if they have been read from another device they will not be moved by a Rule.
Looking for a work-around, does anyone have a applescript that will run as a mail rule to move incoming (unread or read) messages to a folder?

While the applescript below works it has the same problem as the rules, does not move message with read set.
Rule
Created a rule with the following conditions
Account     myIMAPaccount
Perfor the following actions
Run AppleScript     myMoveScript
Stop evaluating rules
Here's the script:
AppleScript run as Mail rule to Move messages
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
move this_message to mailbox "myArchiveMailbox"
end repeat
end tell
end perform mail action with messages
end using terms from

Similar Messages

  • Quickly move selected mail to a folder

    I am looking to quickly move selected mail messages to a given folder. I know of command-option-t but this will use the destination of the last time I moved a message. I want a constant, always the same destination. I tried to remap the delete-key to move to a folder instead of to the trash but that did not work. I tried to specify a menu name (Message->Move To->foldername), but this also did not work (because the menu item has an icon and not just a name?).
    Anyway, any clever ideas around?
    Thanks alot and Merry Xmas to you all
    ---markus---

    I love MsgFiler for this purpose. (I guess that's shorthand for "Message Filer.") It allows me to use keystrokes to access any mailbox. With a message selected, I type "command 1" to bring up MsgFiler, then type in a few letters of the mailbox I want. When it comes up on a list, I can hit "return" to send the message to that mailbox -- simple! Other options include being able to copy to selected mailboxes and opening selected mailboxes through similar easy keystrokes. I love it, and use it to keep my hundreds of messages a day filed properly. Great deal for $8! (I have no affiliation, I'm just a fan.) Here's a link to the site:
    http://www.tow.com/msgfiler/

  • Move Apple mail 2.07 account directory to another location/partition

    Hi all,
    Was bugged by few problems after the update to 10.4.6.
    As follows:
    All my emails disappear after it. Knowing that i previous did some customising of moving to different folder, i try to import it in and everything is there under the folder Import. Solved on my first problem.
    I have since drag all folders from Import to the main and deleted off the folder Import.
    While i starting to add accounts into the new Mail 2.07, i faced another problem. I am unable to set the account directory for the account i have created. This is bugging me as i have all my emails on the other partition and it contains 2GB of all my important emails i need. though i have successfully imported them into Mail 2.07, i wish to move the mail to the other partition so i can have a easier time not needing to housekeep now and then since most of my emails have large attachments with them.
    I tried accessing Andrew Pontious's helpfultiger tips after some searching within this discussion and found that his site is no longer functioning.
    Have also tried the other method of adding a new account without the assistance by pressing "Option" when clicking the "+" icons and the Mail preference panel just hang on me without anything shown. Forcing me to do a force quit on Mail and try again and again. And still, after last night of countless tries, i still unable to progress any further.
    Help needed :
    1. Any ways to push my mail to other partition other than setting the account directory within the account setting to the other partition?
    2. If able to customise the default folder from /Library/Mail to another partition, that will be nicer.
    3. If no way to set the default account directory, possible to customise a folder which is located at the other partition and create a rule to move the mails into that folder?
    Pardon me for this lengthy post as i have been bugged by few other problems other than this Mail and desperately needing help to get my Mail back in order to carry on working.
    N.B: I have tested my iMac hardware, did a disk verification and permission repair and everything is doing fine.

    I must be missing something here, because this is
    starting to make little sense to me. In my previous
    reply I did give you step-by-step instructions
    to accomplish what you want. Have you tried it? Is
    there something there you didn't understand? If
    replacing the HOME/Library/Mail folder with an
    alias doesn't work, I'm pretty sure it can be done
    using Unix symbolic links instead, but I believe
    Finder aliases are preferable here if they work (and
    I believe they do).
    Why on Earth would someone prefer to play with more
    involved hacks that only provide a partial solution
    and that are more likely to cause problems?
    Never doubted your suggestion and was gladful for it.
    However, i tried and my mail didn't show up with those personal folders which i created to categorize the chunk of emails i got. Ended up i reverse the process and everything is back in Mail again.
    One thought after last night of trying, com.apple.mail.plist.
    Will try to see if i can edit the default location ~/Library/Mail to my preferred location on the other partition by means of editing the plist.
    Will update if any result.
    And to all who have responded in this thread, sincerely thank all of you for the time and effort spent to help me out. Thank You!

  • How to save mails from "sent"-folder to another folder (enterprise-server)

    i am using bb with an enterprise server (lotus notes) an would like to save a sent mail from the sent folder to another folder. with my blackberry bold it was no problem to save sent mails like every incoming mails to a folder. but with my Z10 i could read all sent mails but cant save them to a folder. any ideas to solve this?

    Hello,
    Given that you are on BES, you need to work with your BES admins to find out what features and functions exist for you with BB10. If, for example, they have not updated to BES10, then it is possible that some functions will not be available to you until they do. But, only they (your BES admins) can tell you exactly what you should expect from the environment that they control.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Rule - move read mail

    Hi
    Is there a way to write a rule that allows you to move read mail to a folder once it has been read and closed. I was able to do this in GroupWise and it's very handy - so that mail does not get moved before read, as happens now using rules about who mail is from, rather than who mail is from AND whether it has been read and closed.
    Thanks

    Hi there - thanks for the suggestions, they are helpful. The whole situation, though, may not be helped. The problem really is that I like to be able to access my mail on my iPhone, but store mail on my mac so the folders that the mail moves to are actually on my mac. If I accidentally don't shut down my mac when I go out, mail comes in and is moved to the folders on my mac before I can read it on my iPhone. If I could only move mail once I have read it or only when I close mail, then mail coming in would stay on my mobile me inbox for me to read on my iPhone.
    Hope this makes sense! It worked with GroupWise because my mail filed into folders only after read and closed.
    Thanks again for the suggestions.
    Francois

  • After migrating I can no longer define filter rules, as TB states "No available folders" - incoming mails are sorted according to the existing rules into folder

    I had to setup a new computer. I moved the profile data as described here. A new folder (just the icon) appeared out of nowhere (it can't be moved, renamed, deleted, etc.)
    When I highlight a message and select Message -> Create Filter from message, I can not create a rule to move mail to a folder, as the field where I can select the target folder is grayed and it says "No available folders", which isn't true, I have lots of folders, and existing rules that route incoming mail into the correct folders (which have been defined before the move).
    I can not exclude that this isn't related to the move, but to a newer ThunderBird version, as I do not create rules that often.
    I use ThunderBird for different mail accounts with different providers.

    Hello,
    I found the solution.
    For an unknown reason, one of my accounts was defective. I noticed that I did not receive emails from this account and found it that it had turned into that ghost folder.
    After deleting this account (and creating a new account instead), I can again create rules as before.
    I hope someone from the developers takes a look into this, it's quite embarassing.

  • Incoming mail is going to a folder other than inbox. fix?

    Incoming mail is going to a folder instead of inbox.  How do I fix this?

    louiswilliams wrote:
    Incoming mail is going to a folder instead of inbox.  How do I fix this?
    What folder?
    Who is the email provider?

  • Mail from Trash folder moves itself back to Inbox

    I've been having a bit of an odd problem lately -- items from my Trash automatically re-appear in my inbox. It seems to have started with an e-mail from about three months ago, and whenever I click away to another folder (Sent, Drafts, etc.) and then click back to Inbox, another e-mail (in sequence according to date) will re-appear.
    I have been simply deleting the revived e-mails (assuming they would go back to the trash folder), but I just found out that if I delete one of these e-mails, they are deleted for good.
    My trash folder contains approximately 2700 e-mails, and I know I need to look for a mail archival program, but the problem isn't related to a "limit" on e-mails in a folder as far as I can tell.
    Anybody have any idea as to what might cause this problem?
    Any info would sure be appreciated!
    Thanks in advance,
    DAVE
    MacBookPro   Mac OS X (10.4.6)  

    Is there a reason you keep accumulating mail in the Trash mailbox and never permanently erase it? Using the Trash for archiving purposes just doesn't make sense to me. Why don't you create a custom "On My Mac" mailbox folder for that?
    The following is what I would recommend to someone having your problem in "normal" circumstances. Your situation is clearly unusual, so don't blame me if it doesn't work for you
    1. Quit Mail.
    2. In the Finder, go to HOME/Library/Mail/. You may want to make a backup copy of this folder, just in case something goes wrong -- e.g. by dragging it to the Desktop while holding the Option (Alt) key down.
    3. Locate the Envelope Index file and move it to the Desktop (to be deleted later if this fixes the problem).
    4. Launch Mail again and let it finish re-indexing everything -- it says it's "importing", but it's just re-creating the Envelope Index file.

  • Is there a way to automatically move mail from one folder to another?

    Is there a way to periodically, automatically, move mail from one folder to another?
    For example, I'd like to move mail from one of my IMAP/Archives folders to my MyMac/Archive folder and I'd like this to happen without intervention.
    Can this be done?

    I'll try to be more specific.
    When I'm done with an email, I archive it.
    Because I have multiple email accounts, this results in emails in multiple Archive folders (one per account). 
    I'd like to have these automatically all moved into one (on my Mac).

  • HT202303 incomming mail goes to threat folder

    can somebody help me find the treat Folter in my email Acount

    I think its nothing to do with java mail api, it the mail service provider which filter the incoming mail and thinks that it is a junk mail adding it to the bulk folder. If you can open the email and mark the email through which u are sending mails as not junk, then the future email throug this address will be delivered into inbox.

  • How to move all already spam marked e-mails to spam folder?

    Some e-mails are alread marked wich spam (there is a burn icon on it), but still in my main received folder. How to move them all to spam folder at once?

    Did you try select the emails, drag and drop on the Trash Folder?
    Try create a filter to move the emails marked as spam to the Spam folder.
    *[http://mzl.la/1pNQ4G3 Organize Your Messages by Using Filters]

  • Can I move the MAIL folder off my System drive?

    Hi there,
    I'm running Snow Leopard 10.6.7 and using Apple's MAIL email.
    I have a very small 32gig SSD on my Mac G5 8 Core and the folder in USERS>(My name)>LIBRARY>MAIL is 11GB in size. I'd like to move this to a different internal drive, but I imagine if I do so I will find that my mail doesn't work.
    Can anyone help me with the correct procedure for getting this folder off my SSD and onto a different internal drive?
    Maybe if I moved the MAIL application and that MAIL folder to a different internal drive it would work ok? Or can I continue to run the MAIL program from the SSD and move the MAIL folder, the program will find it?
    Any ideas greatly appreciated.
    With thanks,
    Harry.

    Move the Home Folder
    http://macs.about.com/od/diyguidesprojects/qt/Move-Your-Home-Folder-To-A-New-Loc ation.htm

  • I can't move my incoming mail messages into my mailboxes ever since i upgraded to Yosemite. It keeps defaulting to the old arrangement. My email account runs on IMAP.

    I can't move my incoming mail messages on my desktop into my mailboxes ever since i upgraded to Yosemite. It keeps defaulting to the old arrangement. My email account runs on IMAP.

    Hello using the settings from my email provider (Virgin Media), I set up my email account on my Mac. The problem arises trying to move the emails from the Inbox to the various mailboxes I set up. All this is occurring within Apple's Mail  app, not the Desktop.
    Could it be anything to do with the IMAP-enabled synching between my email account on my computer and on Virgin Media's servers where my actions on my computer are not being communicated to the server? I am not an expert and only guessing here! Thanks for pitching in.

  • TS3899 I am unable to move email to the trash folder.  The mail appears to move, but stays in the inbox.

    I am unable to move email to the trash folder.  The mail appears to move, but stays in the inbox.

    Try Settings>Mail, contacts, calendars>Your email account>Advanced>Move Discarded Messages into>Deleted Mailbox.
    Or Settings>Mail, contacts, calendars>Your email account>Account>Advanced>Move Discarded Messages into>Deleted Mailbox....and Mailbox Behaviors>. Deleted Mailbox>Trash.

  • Please help with troubleshooting Applescript invoked by Apple Mail rule

    I set up an account with Boxcar to get push notification of incoming email on my iPhone. I did this because I passworded my iPhone and cannot see incoming messages without entering the password. Now all I need to do is glance at the screen to see whether it's worth it or not to look at the email. In order to use the Boxcar service, I needed to set up a rule to redirect all incoming mail to my private address on Boxcar. The issues that I have are two-fold. First, I do not like blindly forwarding email content to Boxcar regardless of their stated claim that they strip out the sender and subject of a message and discard the rest. Second, if I get a large incoming email, then My method will have to send the large content out again - a waste of resources. To get around this, I tried to write an Applescript for Apple Mail that is invoked by a rule applicable to all messages. The script redirects all messages to my private Boxcar email address and strips out the content of the message. The script follows:
    using terms from application "Mail"
    on perform mail action with messages selectedMessages
    set AppleScript's text item delimiters to ""
    repeat with theMessage in selectedMessages
    set boxcarMessage to redirect theMessage
    tell boxcarMessage
    make new to recipient at beginning of to recipients with properties {address:"[email protected]"}
    set content to " "
    set subject to theMessage's subject
    end tell
    send boxcarMessage
    end repeat
    end perform mail action with messages
    end using terms from
    The problem with this script is that it still sends out the content even though I thought I was setting it to a single space. Other than that, it does just what I need it to do. Any suggestions on corrections, an easier Applescript, or another way to approach the whole issue? One drawback to this approach is that I need to have a Mac running at home that processes the rule for the incoming messages - probably there is no way around this?
    Thanks!

    That makes sense, but then that gets back to your original comment:
    "redirecting the message will send the entire message, as-is."
    I tried to eliminate the attachments by adding the line:
    delete boxcarMessage's attachments
    but it did not work - the attachments were redirected also. So here is the script as it stands now:
    using terms from application "Mail"
    on perform mail action with messages selectedMessages
    set AppleScript's text item delimiters to ""
    repeat with theMessage in selectedMessages
    set boxcarMessage to redirect theMessage
    delete boxcarMessage's attachments
    tell boxcarMessage
    make new to recipient at beginning of to recipients with properties {address:"[email protected]"}
    end tell
    delay 3
    send boxcarMessage
    end repeat
    end perform mail action with messages
    end using terms from
    I appreciate the input. Intuitively it seems like this is doable, but the solution escapes me.

Maybe you are looking for

  • G-Drive Mini disconnects itself

    Hello everyone, This has happened a few times, too many to ignore. When I leave my MBP on and go away for a while, when I come back and take it out of sleep mode, or just the screen saver, I get that message when you unplug a device without properly

  • Burning a dvd of photos compatible with pc and mac

    I don't know if this is the correct forum or not.... can someone direct me on how to burn a dvd of pics and videos that is compatible with both a pc and a mac. i exported the photos to a folder on my desktop and have tried to burn with finder, and wh

  • Are you using the new features?

    Some of you were very loud about getting certain features for PlayStation 4 and some even complained that they weren't available on day day1. You asked for suspend/resume, a media player, dlna, the ability to pause downloads and you got it. So are yo

  • Safari do not remember my settings

    I am using Safari 6.0.1 on OS X 10.8.2, Safari dose not remember: my toolbar arrangement other setting like the default search engine, homepage, etc....

  • Can't find 1:1.85 aspect option when creating Project

    Can't find 1:1.85 aspect option when creating Project. I have files shot on Canon C300 in 16:9, but we had the 1:1.85 aspect lines on the camera and I can't figure out how to incorporate those frame lines for editing. Is the best way to do it when cr