# Installed the update - can not import mail&attach from mail

**URL:** <https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258>\
**Category:** Tips\
**Created:** [January 30, 2015, 2:01am UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258 "2015-01-30T02:01:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Basil\_Fawlty](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/basil_fawlty/32/35880_2.png) [@Basil\_Fawlty](https://discourse.devontechnologies.com/u/Basil_Fawlty)\
**Post date:** [January 30, 2015, 2:01am UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/1 "2015-01-30T02:01:01Z")

</div>

Not sure what I did wrong.

After the update today I can not use the script “Add messages & attachments to Devonthink” in Apples Mail.

Get the error message: Mail got an error: AppleEvent handler failed.

Sucks to be a newbie! Still love the Devonthink system just not so good with it yet.

---

<div class="post-metadata">

**Author:** ![scottlougheed](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/scottlougheed/32/5383_2.png) [@scottlougheed](https://discourse.devontechnologies.com/u/scottlougheed)\
**Post date:** [January 30, 2015, 2:17am UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/2 "2015-01-30T02:17:40Z")

</div>

No problems here. Perhaps try re-installing the mail plugin by going to:  
DEVONThink Pro Office\>Install Add-Ons  
ensure mail plug-in is checked, and confirm the installation.

---

<div class="post-metadata">

**Author:** ![Basil\_Fawlty](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/basil_fawlty/32/35880_2.png) [@Basil\_Fawlty](https://discourse.devontechnologies.com/u/Basil_Fawlty)\
**Post date:** [January 30, 2015, 3:18am UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/3 "2015-01-30T03:18:10Z")

</div>

Yup, that helped! Now it works fine again.

Thanks. 😃😃

---

<div class="post-metadata">

**Author:** ![scottlougheed](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/scottlougheed/32/5383_2.png) [@scottlougheed](https://discourse.devontechnologies.com/u/scottlougheed)\
**Post date:** [January 30, 2015, 3:47am UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/4 "2015-01-30T03:47:15Z")

</div>

Glad to hear that resolved your issue!

Cheers,  
S

---

<div class="post-metadata">

**Author:** ![Plip](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@Plip](https://discourse.devontechnologies.com/u/Plip)\
**Post date:** [February 27, 2021, 1:48am UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/5 "2021-02-27T01:48:02Z")

</div>

Hi there, I have the same problem.  
I can’t use the rule at Apple Mail to import only mail attachments to my DEVONthink.

I tried to explain my issue with my attached images 🙂

PS: I’m not able to reinstall the Apple Mail Plugin - resp. I don’t know how

 ![IssueNo1](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/7/6/76f5818a1d6ce0f3287665db895813c26a0fe1d0.jpeg)

 ![IssueNo2](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/5/f/5f3cd1154868dfa59dbf0bbcc3340b2fe034e6ee.png) ![Mail-Dropdown](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/1/a/1a90823304de190be62acb2e76c20213d9544a4d.jpeg)

---

<div class="post-metadata">

**Author:** ![Blanc](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/blanc/32/8008_2.png) [@Blanc](https://discourse.devontechnologies.com/u/Blanc)\
**Post date:** [February 27, 2021, 8:14am UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/6 "2021-02-27T08:14:46Z")

</div>

See [here](https://discourse.devontechnologies.com/t/apple-mail-missing-add-to-devonthink3/52573/2)

---

<div class="post-metadata">

**Author:** ![Plip](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@Plip](https://discourse.devontechnologies.com/u/Plip)\
**Post date:** [February 27, 2021, 2:45pm UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/7 "2021-02-27T14:45:05Z")

</div>

Thanks @Blanc I went through the routine. But now there are no documents imported to DT.  
So I’m executing my Mail Script but there are no documents in my inbox of DT.  
Before this routine a few AppleScripts worked as expected (as you can see at my screenshots posted earlier).

> [@Apple Mail Missing "Add to DEVONthink3"](https://discourse.devontechnologies.com/t/apple-mail-missing-add-to-devonthink3/52573/2):
>
> face_with_head_bandagestuck_out_tongue To ensure things are installed and enabled properly, do this… Quit Mail. Quit DEVONthink 3. Enable Full disk access in System Preferences \> Security & Privacy \> Privacy for DEVONthink 3 In the Finder, hold the Option key and choose Go \> Library. Go into the Mail/Bundles folder and delete the DEVONthink.mailbundle. Relaunch DEVONthink 3 and install the Mail plugin from DEVONthink 3 \> Install Add-Ons. Relaunch Mail and enable the plugin via Apple Mai…

---

<div class="post-metadata">

**Author:** ![Blanc](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/blanc/32/8008_2.png) [@Blanc](https://discourse.devontechnologies.com/u/Blanc)\
**Post date:** [February 27, 2021, 3:11pm UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/8 "2021-02-27T15:11:26Z")

</div>

Does it work if you use the menu entry (add mail to DEVONthink” it’s called, I think)?

---

<div class="post-metadata">

**Author:** ![Plip](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@Plip](https://discourse.devontechnologies.com/u/Plip)\
**Post date:** [February 27, 2021, 3:16pm UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/9 "2021-02-27T15:16:15Z")

</div>

No, unfortunately not.  
It’s called “Mail rule - add messages to DEVONthink”. But also with this type of AppleScript there is no document input at DT3.

---

<div class="post-metadata">

**Author:** ![Blanc](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/blanc/32/8008_2.png) [@Blanc](https://discourse.devontechnologies.com/u/Blanc)\
**Post date:** [February 27, 2021, 4:18pm UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/10 "2021-02-27T16:18:58Z")

</div>

No, I meant in Mail, in the menu select “Message/Add to DEVONthink 3” - does that work? I’m aware that isn’t what you’re trying to do, it’s just part of trouble shooting.

Also, in System Settings, Security and Privacy, Automation, is Mail allowed to control DEVONthink 3?

---

<div class="post-metadata">

**Author:** ![Plip](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@Plip](https://discourse.devontechnologies.com/u/Plip)\
**Post date:** [February 27, 2021, 4:31pm UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/11 "2021-02-27T16:31:38Z")

</div>

Ah okay, got it, thanks 🙂

Yes, when I’m clicking on the sub menu at “add to DEVONthink” I get the sorter from DT and I am asked where to put the mail. And then I can directly see the mail at DT.

At System settings, everything is activated 👍

 ![automation](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/a/e/aedf2b521515e5c5cc907db7522fa5d58938dc06.png)

---

<div class="post-metadata">

**Author:** ![Blanc](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/blanc/32/8008_2.png) [@Blanc](https://discourse.devontechnologies.com/u/Blanc)\
**Post date:** [February 27, 2021, 5:17pm UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/12 "2021-02-27T17:17:42Z")

</div>

Ok, so I’ve just sat down at home to try this - and I can confirm it does not work. It will work once the attachment has been opened from Mail once.

@cgrunenberg the script in question sets `theFolder` to a folder which in my tests is initially empty; I can see the attachment inline in the Mail, but only once it has been manually opened is it placed in the temporary folder (and only then does the script work). Is there any way to adapt the script to trigger Mail to get/download the attachment to `theFolder` without having to manually open the attachment?

---

<div class="post-metadata">

**Author:** ![Plip](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@Plip](https://discourse.devontechnologies.com/u/Plip)\
**Post date:** [February 27, 2021, 5:41pm UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/13 "2021-02-27T17:41:06Z")

</div>

I really like the community here and the quick response! 🙂  
Thank you @Blanc

Unfortunately with attachments which has been opened before I can’t send the attachment to DT with own created apple mail rules (“Mail rule - add messages to DEVONthink”).

---

<div class="post-metadata">

**Author:** ![Blanc](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/blanc/32/8008_2.png) [@Blanc](https://discourse.devontechnologies.com/u/Blanc)\
**Post date:** [February 27, 2021, 5:44pm UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/14 "2021-02-27T17:44:18Z")

</div>

> [@Plip](#):
>
> Unfortunately with attachments which has been opened before I can’t send the attachment to DT with own created apple mail rules (“Mail rule - add messages to DEVONthink”).

Certainly not automatically, no; I’ll sit down later this evening and see if I can find anything in Mail’s AppleScript directory which would cause Mail to put the attachment in the temporary folder without manually opening it (@pete31 I wonder if you have any ideas off hand?)

---

<div class="post-metadata">

**Author:** ![pete31](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/p/d26b3c/32.png) [@pete31](https://discourse.devontechnologies.com/u/pete31)\
**Post date:** [February 27, 2021, 7:16pm UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/15 "2021-02-27T19:16:11Z")

</div>

> [@Blanc](#):
>
> I wonder if you have any ideas off hand?

Nope.

---

<div class="post-metadata">

**Author:** ![Blanc](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/blanc/32/8008_2.png) [@Blanc](https://discourse.devontechnologies.com/u/Blanc)\
**Post date:** [February 27, 2021, 7:28pm UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/16 "2021-02-27T19:28:30Z")

</div>

> [@pete31](#):
>
> Nope

Ok, at least that made me laugh at the futility of my quest 🤪

---

<div class="post-metadata">

**Author:** ![Blanc](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/blanc/32/8008_2.png) [@Blanc](https://discourse.devontechnologies.com/u/Blanc)\
**Post date:** [February 28, 2021, 5:23pm UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/17 "2021-02-28T17:23:34Z")

</div>

so, here goes:

```auto
-- Mail Rule - Add attachments to DEVONthink
-- Created by Christian Grunenberg on Fri May 18 2012.
-- Copyright (c) 2012-2020. All rights reserved.

using terms from application "Mail"
	on perform mail action with messages theMessages for rule theRule
		tell application "Mail"
			set theFolder to (POSIX path of (path to temporary items))
			repeat with theMessage in theMessages
				set theSender to the sender of theMessage
				repeat with theAttachment in mail attachments of theMessage
					try
						-- if downloaded of theAttachment then
						set theFile to theFolder & (name of theAttachment)
						tell theAttachment to save in theFile
						tell application id "DNtp"
							set theAttachmentRecord to import theFile to incoming group
							set URL of theAttachmentRecord to theSender
							perform smart rule trigger import event record theAttachmentRecord
						end tell
						-- end if
					end try
				end repeat
			end repeat
		end tell
	end perform mail action with messages
end using terms from

```

What I have done is to comment out the _downloaded_ condition. It would seem Mail is reporting the attachment has not been downloaded, so that Christian’s script breaks off at that point. However, for me anyway, the attachment is available to be saved - after commenting out the condition the script/rule works as expected. If the attachment really isn’t available I would assume that would have no further negative impact, as the save command is in a try-loop anyway.

In case you are not aware: you can access the script by selecting “Im Finder öffnen” in the last of your images in your original post. That will open the folder containing the scripts; open the script in question, add `--` in the two locations (that is before `if` and `end if`) and save.

---

<div class="post-metadata">

**Author:** ![Plip](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@Plip](https://discourse.devontechnologies.com/u/Plip)\
**Post date:** [March 1, 2021, 6:46pm UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/18 "2021-03-01T18:46:18Z")

</div>

@Blanc you are fantastic! Thank you very much!  
I followed your steps and it worked immediately. 🥳

---

<div class="post-metadata">

**Author:** ![Blanc](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/blanc/32/8008_2.png) [@Blanc](https://discourse.devontechnologies.com/u/Blanc)\
**Post date:** [March 1, 2021, 7:01pm UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/19 "2021-03-01T19:01:21Z")

</div>

Well that’s most pleasing 🙂

---

<div class="post-metadata">

**Author:** ![jkssl](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@jkssl](https://discourse.devontechnologies.com/u/jkssl)\
**Post date:** [April 12, 2021, 6:11pm UTC](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258/20 "2021-04-12T18:11:08Z")

</div>

I tried the comment-out proposal by @Blanc but it doesn’t work for me unfortunately ☹ I tried it many times, restarted each of the programs.

I’m running 10.15.7 on an intel mac, devonthink 3.6.3

I wonder why there’s a set of scripts named almost the same in Library/Scripts/Applications/Mail which works (but only manually when selecting emails) and starts with `tell application "Mail"` (not `using terms...`). I did the same change as to the Script in “Application Scripts/com.apple.mail”

[Next page](https://discourse.devontechnologies.com/t/installed-the-update-can-not-import-mail-attach-from-mail/18258.md?page=2)
