"Filter Mail Messages" in Automator doesn't filter out mails of today

Is it me, or does the Automator action "Filter Mail Messages" doesn't have an option to find messages that have not been sent or received today. It seems that there is no option to get rid of the messages sent or received today while filtering.
I mean there is no option for "Date received" -> "Not today"; and I seem to can not find any easy workaround for this.
i.e. What I'm trying to do is, filter the messages that are in a certain mailbox and are not sent or received in the last 7 days. However, the mails of today always show up.
I hope somebody had found a solution to this, it appears to be an obvious problem with the Automator, trying to work with the Mail App and many have probably run into this before.
Thanks!

OK.... Did a bit more debugging... updated script
property secondsIn21Days : 1814400
on run {input, parameters}
  try
  set dateToday to current date
  tell application "Mail"
  set archiveCount to 0
  set theArchiveMailboxName to "CurrentArchive"
  if (mailbox theArchiveMailboxName exists) = false then
  make new mailbox with properties {name:theArchiveMailboxName}
  end if
  repeat with aMessage in input
  -- set theMessages to input
  -- repeat with aMessage in theMessages
  set messageRDate to date received of aMessage
  set messageSDate to date sent of aMessage
  set messageSubject to subject of aMessage
  set messageID to id of aMessage
  set timeRDifference to 0
  set timeSDifference to 0
  -- if messageRDate > 0 then
  set timeRDifference to dateToday - messageRDate
  -- end if
  -- if messageSDate > 0 then
  set timeSDifference to dateToday - messageSDate
  -- end if
  display dialog messageSubject & " " & messageID & " " & timeRDifference & " " & timeSDifference
  if timeRDifference > secondsIn21Days then
  display dialog "Move " & messageID & " Received" & messageRDate & " " & messageSDate
  move aMessage to mailbox theArchiveMailboxName
  set archiveCount to archiveCount + 1
  else if timeSDifference > secondsIn21Days then
  display dialog "Move " & messageID & " Sent" & messageRDate & " " & messageSDate
  move aMessage to mailbox theArchiveMailboxName
  set archiveCount to archiveCount + 1
  end if
  end repeat
  end tell
  display notification "emails archived = " & archiveCount with title "Mail Archive"
  -- return -- Successful completion of handler.
  on error errStr number errorNumber
  -- If our own error number, warn about bad data.
  -- if the errorNumber is equal to 750 then
  -- display dialog "All items in the list must be integers."
  -- return integerSum -- Return the default value (0).
  -- else
  -- An unknown error occurred. Resignal, so the caller
  -- can handle it, or AppleScript can display the number.
  error errStr number errorNumber
  display notification "emails archived = " & archiveCount with title "Mail Archive"
  -- end if
  end try
end run

Similar Messages

  • I can't open mail/ message "can't use this version of mail with Mac OS X  this occurred after security update

    I can't open mail/ message "can't use this version of Mail wigh this version of Mac OS X" this change occurred after a security update. tried to open in application with same responce.

    Mac OS X v10.6: "You can't use this version of Mail…" alert after installing Security Update 2012-004

  • How can I save mail messages to my computer and not my mail program

    My mail program seems to be slow.  I'm not sure why.  I get the spinning ball frequently.  I need to save mail messages sometimes for a few years and there are hundreds of emails. Is it better to save them on my computer than my mail program?  I may need to retrieve them at some other time so they need to be readable.  Is that possible?
    I'm using OS X 10.9.4. I have a 3.06 GHz processor and 12 GB of memory.  Thanks

    You can select to export a folder to save as a .mbox file. This file would need to be imported if you wanted to view the messages.
    Select mailbox (folder)
    Under Mailbox in the Menu bar select Export Mailbox...
    You might also want to check out the demo for EagleFiler by the author for SpamSieve. You could view and search the messages archived in EagleFiler.
    http://c-command.com/eaglefiler/
    Regarding Mail being slow....
    Is it only Mail that is slow?  How much free space on your drive? Use Disk Utility to find available space.

  • Is there a way to recover a deleted ( by accident) e-mail message on my iPad? The e-mail was created, I thought I hit the send button..

    Hi there,  does anyone know how to recover a newly created e-mail message that was possibly deleted instead of sent.  I think my I may have hit the delete button instead of the send button? I have searched all my e-mail folders: draft, trash, sent etc.  Any help would be greatly appreciated.

    Yes with an Exchange or IMAP account, which are designed for this very thing.
    All server stored mailboxes with an Exchange or IMAP account are synchronized with the server with each email client used to access the account.
    This is not possible with an antiquated POP account which was designed to be accessed with a single email client only - developed when the overwhelming majority of computer users had one computer - a desktop, and before notebooks were commonplace.

  • Apple Mail message read status doesn't change when read

    In Apple Mail, when getting mail from an Exchange 2010 server on the corp LAN works great. However, on about 2 out of 10 messages, after I read the message it still has the "dot" showing it as unread and I have to manually select mark > as read. I even let it sit for a while thinking it has to sync but no luck. I still have to manually mark it. Very frustrating. Any ideas?

    To clarify something else, the unread mail badge disappears off of the app in the tray as well as the inbox in the lefthand column. But the blue dot remains on the conversation thread.

  • Mail messages are marked "junk" in the outgoing mail box

    For some time all my outgoing email messages have been marked as "junk" in the sent mail box. Today found that if I do not mark my personal information in my address book as "Me" my sent messages are no longer marked "junk". Does anyone know how I can fix the problem so my personal information can be marked "Me"?
    iMac intel   Mac OS X (10.4.8)  
    iMac intel   Mac OS X (10.4.8)  

    The following procedure thoroughly gets rid of all the files used by the junk filter, so that Mail creates them anew, and should fix the problem in the cases where the simple procedure provided in my first post doesn’t:
    1. Quit Mail if it’s running.
    2. In the Finder, go to ~/Library/Mail/.
    3. Locate LSMMap2 and move it to the Trash. This file stores information about what does and doesn’t constitute junk, and allows the junk filter to learn. Deleting this file is what Preferences > Junk Mail > Reset does. The file was called LSMMap in early versions of Mail; delete that as well if you see it.
    4. Locate any MessageRules.plist (Mail 2.x) and/or MessageSorting.plist (Mail 1.x) files and move them to the Desktop. This is where Mail stores all the rules, including the rule that governs what the junk filter does.
    5. Locate DefaultCounts and move it to the Trash. This file keeps statistics about the number of messages that have been marked as junk, either automatically by the junk filter or manually by the user.
    6. Look for the account folders. The name of each account folder starts with the account type (POP, IMAP, Mac), followed by the account username and the incoming mail server. Open each of the account folders, locate the Junk.mbox or Junk.imapmbox folder within it, and move it to the Trash if present.
    7. Go to ~/Library/Mail/Mailboxes/. Locate any Junk.mbox mailboxes there (their name may include the account name in parenthesis), and move them to the Trash.
    Note: Steps 5, 6 and 7 may be unnecessary. Also, messages in Junk mailboxes with an .mbox suffix are stored locally and will be lost forever as a result of doing steps 6 and 7. If there is a chance that you have legit messages there that you want to preserve, either try skipping those steps, or move the messages to another mailbox in Mail first, or move Junk.mbox to the Desktop (to be imported back later) instead of to the Trash. Junk mailboxes with an .imapmbox suffix aren’t a concern because they are stored on the server and Mail would rebuild them automatically.
    8. Open Mail. As a result of removing the rules file, the junk filter will be disabled now. You may want to either tell Mail to go offline immediately after opening it, or shut down the Internet connection before opening Mail, to prevent it from downloading anything until the junk mail filter has been enabled again.
    9. Go to Mail > Preferences > Junk Mail, enable junk filtering, and configure it however you wish.
    10. Go online again if you went offline in step 8.
    If the above solves the problem and you don’t have any rules you’d like to preserve or recreating them is not a daunting task, just trash the rules files that were moved to the Desktop and be done with it.
    Note: For those not familiarized with the ~/ notation, it refers to the user’s home folder. You can easily locate any of the folders referred to in this post by copying the folder path here, doing Go > Go to Folder in the Finder, and pasting the folder path there.

  • View mail messages as plain text by default in Mail (7.0)

    It appears as if Apple removed this very useful feature.
    I prefer to look at e-mail in plain text. It gets rid of ridiculous formatting choices and inline images and most importantly, web bugs. So I've always set my mail clients to disable any kind of formatting and display the messages in plain text.
    I can't do that in Mavericks Mail.app, at least as far as I can tell.
    Bad choice, Apple.

    Most mailers recognize plain text and html, and that's all they're expected to do. If you need a special feature like that you'll have to script it yourself.

  • Mail read on iPhone doesn't appear in Mail on the Mac

    This is probably a newbie issue, but I can't find any way to resolve it in FAQs etc.
    When my wife opens and reads an email message on her iPhone, that message then does not appear in her inbox on our Mac.
    Can anyone tell me how to resolve this?
    Is it a matter of setting up the mail account separately on the iPhone.
    Many thanks for any advice.
    Scott

    Reading a recieved message with a POP account with one email client by itself does not prevent the message from being downloaded and read with another email client. The iPhone's Mail client does not include an option for removing messages from the server when downloaded with a POP account as is available with an email client on your computer such as the Mail.app.
    A problem with a POP account is only one email client at a time can access the incoming mail server for new messages and download any new messages. If a 2nd email client attempts to do this while another email client is doing the same, the 2nd email client will be temporarily locked out by the incoming mail server.

  • Number of mail messages does not match the number in mail activity

    This is not a big deal but I have noticed that when mail arrives the Mail Activity window tells me how many incoming messages are being downloaded. This number often bears no relationship to the number that arrive. For example it might read 4 messages are downloading when in reality only 1 arrives. If I look at my webmail all messages are listed. Does anyone know what causes these inconsistencies?

    I do not have any answer, but I have the same problem. AND the RSS feeds do not make up the difference; and yesterday I disabled junk mail filtering. And I've made certain that I have no unread mail left over. Yet Mail Activity reported downloading 16 messages, but I only received 8. This happens daily, but the proportion of unaccounted emails varies.

  • Mail message listed on iPhone but not in Mail on my iMac

    Today I received a message on my iPhone but when I went to reply to it on my iMac the message did not appear even when I searched for it.
    It also shows in my mail server's Webmail. This is very scary. How many other messages am I missing?

    Mail troubleshooting - Yosemite
    What does Mail/Window/Connection Doctor Show? If the server is red, select it and look at the Show Details box.
    Troubleshooting sending and receiving email messages
    Troubleshooting sending email messages
    SMTP servers keep going offline

  • Mail in Mavericks is not downloading mail messages if I read them in iOS mail app. Why?

    More info:
    The accounts in question are domains hosted by Google.  Needless to say this is frustrating as in some cases I have to download the attachments in those messages, I have to forward the emails to another account in order to see them.
    I have a feeling if a message is marked read the mail application does not bother to grab them.  This is a different behaviour than before prior to the update.  I'd appreciate any solutions.
    Thanks in advance.

    The warranty entitles you to complimentary phone support for the first 90 days of ownership.

  • Clicking an e-mail link in Safari doesn't open default mail client

    Eudora has been my default mailer for many years. Yet after the last Safari update a few days ago, the browser suddenly ignores Eudora's default status although it is clearly checked in Eudora's preferences. Instead, Safari thinks Mail is my default mailer. So I dutifully open Mail--I never use it--and check its preferences, which mysteriously assign it as default mailer. I change that setting to Eudora. And the next time I try to click an email link in Safari, Mail pops up again as the default mailer. If I check both email client preferences at that point, both are still set to be my default mailer even though I changed Mail to NOT be so.
    How do I make Safari/Mail stop overriding my setting of Eudora as default mailer?
    --Karen

    HI,
    Try troubleshooting the Safari .plist file.
    Open a Finder window. Select your Home Folder in the Sidebar on the left. It has a small house icon. Then open the Library folder then the Preferences folder.
    Move the com.apple.Safari.plist file from the Preferences folder to the Desktop. Now launch Safari. If you can set the default Mail app, move the .plist file to the Trash.
    Also, from the Safari menu bar click Safari / Empty Cache.
    Carolyn

  • Secondary e-mail in address book doesn't sync in mail?

    Hey,
    If a contact in address book has two e-mail addresses - for example:
    [email protected]
    [email protected]
    only the first one will be linked in Mail to the contacts address book card (i.e. that when I receive an e-mail from [email protected] it will be linked to his address book card, but if he sends me an e-mail from [email protected], it won't show up!). Is this the way it is, and if so is there a way to solve it?
    Also - in the "from" column in Mail, it shows the senders prefered name and not the name I have in address book. For example it says "jeff" instead of "Jeff Robinson". When viewing the mail itself though, it says "Jeff Robinson" as sender in the header. Why not sync it like that in both email header AND column viewer of all e-mails??
    Thanks for help

    I don't really know... iSync on Panther (10.3.9) is really old and it seems much have changed in Tiger... maybe it's a good decision to upgrade

  • Where did Automator put the text from my mail messages?

    Hi,
    I just used Automator for the first time to gather a bunch of e-mail addresses, then put them into one text file.
    There were two actions I used, Get Specified Mail Messages and Combine Mail Messages.
    Automator says Workflow Execution Completed. Great! Now I want to open this text file and print it.
    Any ideas where to find the text?
    Thanks.
    Anneliese

    To La La land
    You need to add New Text File action from TextEdit Library.
    You the specify the file name and location for it.

  • Why I cannot assess deleted Apple mail messages in time machine after installing mountain lion from snow leopard.

    Ever since I installed Mountain Lion from Snow Leopard, I cannot retrieve my deleted Apple mail messages from Time Machine.  I could do it in the past using Snow Leopard.  The effective date for the the non-retrival of deleted messages is the date I installed Mountain Lion from Snow Leopard.  Any thoughts?

    Keith Montreal wrote:
    It was origionally a local folder for things like receipts from the Apple Store, etc
    I'm still not sure what you mean . . . is it listed in the "On My Mac" section in Mail's sidebar, like these?
    Mountain Lion appears to have given it an icon very much like an Archive box and put the "on My Mac" folder within that "Box" on both the back ups and the new Mail program - in fact it did it 6 times, which was the origional problem.
    Can you post a screenshot?
    I could restore inbox messages although they came in as a new mail box called Time Machine rather than into their origional mailboxes (there are 7 different addresses)
    Yes, that's how Time Machine restores Mail messages, so it doesn't erase the current contents of an existing mailbox.  You can then move them into the desired location.

Maybe you are looking for