How can I clean-up (delete) mail messages after import into Devonthink?

I regularly import mail into devonthink. Is there any way that I can select those messages in mail and delete them?

Carl

How exactly do you import them?

I use the import mail function in Devonthink. (It is one of the options at the top of the left sidebar)

Screen Shot 2022-05-23 at 14.51.50

There is no automatic deletion of emails when importing them via the Import sidebar in DEVONthink. Development would have to assess providing such a behavior.

There is also the possibility of importing within Apple Mail and using one of our application scripts. Here is an example, modified to delete the email from Mail after import.

Add & delete message(s) to DEVONthink.scpt.zip (5.3 KB)

Unzip and put the script in ~/Library/Scripts/Applications/Mail.

Bear in mind this completely removes the email from Mail. It does not put it in the Trash of your account.

I think the best practice would be after importing mail the user deletes manually on the mail account. Already there is uncertainly about the difference between Archiving and Importing. Doing it all automatically seems only to increase the risk of tears.

3 Likes

Agreed. Just showing a possibie approach (though one I wouldnā€™t use myself).

2 Likes

I just collect them together with a flag or something before I import then manually delete. I agree with others here that any kind of automatic deletion on import would be risky really. Mostly I donā€™t care if an email gets lost frankly. BUT there is always just that one that needs a belt and braces approachā€¦ sometimes after years in my case.

1 Like

Thank you ā€¦ I also use the scripts provided in Mail when doing things one at a time. When doing an individual import it is easy to identify the message that I imported and delete it process it immediately.

I was wondering if there was anyway for me to identify in the mail app (as DT does internally) the messages that have been imported so that I can search / select / process them in the mail app.

Thank you ā€¦ I am not trying to automatically delete them. Rather I am looking for a way in the mail app to identify the messages that were imported so that I can ā€œmanuallyā€ post-process.

DT tracks the mail it has already imported ā€¦ so I was hoping that ā€œflagā€ would be available to me.

Thereā€™s no flag but the UUID of imported emails and the message ID in Mail are comparable:

-- Returns <message id> in case of an imported email
tell application id "DNtp" to return uuid of selected record 0

-- Returns just the message id without enclosing <...>
tell application "Mail" to return message id of item 1 of (selection as list)
1 Like

One of the reasons why I use MailMate on my Mac for processing email is its combinations of mail rules and processing commands. So I have rules that identity various kinds of email I want archived into DEVONthink, then deleted afterwards. MailMate can perform permanent deletion from your mailbox, as well as sending items to the deleted folder ā€” obviously, make youā€™ve tested your rule works before adjusting it to delete afterward, and be aware that permanent deletion means you most likely wonā€™t get that message back!

Sorry I misunderstood. You could still collect them or use one of the native OS flags to mark them like I said though? I use a keyboard shortcut I have set up via Keyboard Maestro and also just the regular ā€˜toggle flagā€™ shortcut. I suppose you have them organized some other way in Mail? Some of this is very individual isnā€™t it! In fact I avoid getting to complicated on Apple Mail for all kind of reason and keep it very bare bones and am quite grateful if it works at all with DEVONthink 3; they seem to have cracked it on the DEVONthink 3 side, which I think took some doing.
However I donā€™t have complicated or a lot of email to put into DEVONthink 3. Let us know the solution you come up with or decide on it will be interesting.

I am using MailSuite for AppleMail ā€¦ I have not taken the time to implement sorting / flagging rules ā€¦ I had just been doing search and import on the DTPro side. Will investigate further.

I am also implementing various emails for my separate roles ā€¦ I am active on several Town Boards ā€¦ PROTONMail makes this easy as does Appleā€™s HideMyEmail.

Thanks.

TNX ā€¦ will post how I figure this out. Some combination of sort / flag on the mail side before importing, some portion of Christianā€™s apple script ā€¦

I get emails related to my roles on various Town Boards, receipts for bills, invoices, etc ā€¦ amongst all the DROSS ā€¦ that I want to keep. DTPro is better for archiving mail than mail.

1 Like

Bear in mind this completely removes the email from Mail.

But deleting from Mail may / does not remove the email from the ISPā€™s server.

My ISP told me that when recently I kept getting messages that I was almost up to the limit, my max is my max is 1536M. I thought it was span but no. My ISP sent me a link to its WebMail Server - account login - so I can delete as and when. So far i have deleted enough messages (Inbox and Sent Messages) to reduce from over 90% full to around 30% full.

fao - rmschne Yes i am using POP3

If you use the IMAP protocol, deleting on the local PC Apple ā€œMailā€ app should delete mail on the server. If not, something is wrong or you configured mail to use another protocol, e.g. POP3 or something.

Do an internet search on ā€œapple mail not deleting mail on serverā€ for some ideas.