Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Avoid sending Mail with unattached attachments Apps
Tiger only hintI have this annoying habit of sending emails that refer to an attachment, only to realize after sending that I never actually attached anything. So I wrote a plug-in for Mail.app that scans my messages when I hit Send. If there's no attachment, and it looks like I'm referring to one in the body, it pops up an alert to confirm sending.

I've also written up a tutorial on how to write a Mail.app plugin, but be warned! It's aimed at the experienced programmer.

[robg adds: I tested the plug-in and it works as described. I didn't bother with the how-to, given my lack of programming skill!]
    •    
  • Currently 3.40 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (5 votes cast)
 
[21,322 views]  

10.4: Avoid sending Mail with unattached attachments | 39 comments | Create New Account
Click here to return to the '10.4: Avoid sending Mail with unattached attachments' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Avoid sending Mail with unattached attachments
Authored by: adipoos on Apr 05, '06 07:20:29AM

Genius - pure genius! Thanks for this - I'm *always* forgetting to add attachments, so its just what I've been looking for, especially as I am job hunting at the moment and nothing is worse than forgetting to send a prospective employer your CV!



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: rotero on Apr 05, '06 07:26:53AM

Any chance that someone might create something like this for 10.3.9? I make the mistake of sending messages without their attachments all the time, and it never gets less frustrating.



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: bperkins on Apr 05, '06 07:36:02AM

Just this morning I forgot to include an attachment. Thanks.

One question. Since I do not have mail bundles folder I created that and I tried entering in the information you said into Terminal to set this up I receive this error:

-bash: fg: %: no such job

I am not very schooled in Terminal. So any help would be appreciated.

---
Brad



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: periche on Apr 05, '06 07:40:14AM

You do not need to type the '%' character into your terminal. It represents the prompt that you will see in your terminal window.



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: bperkins on Apr 05, '06 11:28:59AM

Thanks for the help.

---
Brad



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: tqwhite on Apr 05, '06 01:04:22PM

There is something systematic, and reparable, going on. These three plugins stopped working when I moved to intel. I note that they have the same error message as this the Attachment Helper I long for.

I wonder... Could it be that the bundle was created on a G4? Might perhaps, reverting to source and recreating the bundle fix it up?

Unfortunatley, I don't know how to do such things.

tqii

FYI, they are:

SparkPlugInputManager

CPNoteBook

SIMBL



[ Reply to This | # ]
SIMBL for Intel Macs
Authored by: sjk on Apr 05, '06 05:09:05PM
The recently released SIMBL 0.8.1 is Universal Binary.

[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: bnj on Apr 05, '06 07:46:53AM

This sounds great! I just forgot an attachement 5 minutes ago.

How does it work? Do you scan for the words "attached", "attachement", etc?

What if I write in some other language? Is there a way to make your plugin language-sensitive?



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: stealthgeek on Apr 05, '06 08:30:13AM

It seems to work with messages in French, but then the word attachment has the same root as in English (attachement, attach, etc.). It is probably looking for words that contains this root.

---
Stealthgeek



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: bitprophet on Apr 05, '06 08:00:24AM

Awesome idea, but it doesn't appear to work on my machine. Console shows the extremely unhelpful error message:

2006-04-05 10:45:09.129 Mail[27081] *** -[NSBundle load]: Error loading code /Users/cyrus/Library/Mail/Bundles/AttachmentScannerPlugin.mailbundle/Contents/MacOS/AttachmentScannerPlugin for bundle /Users/cyrus/Library/Mail/Bundles/AttachmentScannerPlugin.mailbundle, error code 2 (link edit error code 0, error number 0 ())

I'm willing to bet it has something to do with either the fact that I'm running on an Intel iMac, or that I have a second Python (2.4) framework installed, alongside Apple's 2.3.5.

Obviously if it was straight Python it shouldn't be affected by the processor type; I don't know if PyObjC would care. The extra Python framework should also not matter to my knowledge--as far as I can tell the bundle looks to the original Python install which is untouched.

Anyway, I'd love to run this plugin if I can get it to work :)



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: bitprophet on Apr 05, '06 08:06:20AM

Oh, and before anyone asks, I have other bundles working just fine, so it's not that :)



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: tokenfirstyear on Apr 05, '06 11:16:20AM

Same here - running 10.4.6 on core duo powerbook - err - MacBook Pro.

This plugin could potentially save my life, and it doesn't work on my machine...

:(



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: cejones on Apr 05, '06 08:08:42AM

Anyone know of something similar that works with Outlook? I am always forgetting to actually "add" the attachment... and end up having to send a second email with alot of "oops" in it.

Hehehe

Great idea

Chris



[ Reply to This | # ]
Brilliant
Authored by: sinjin on Apr 05, '06 08:11:21AM

Best hint here in a long time (and that is saying something)!

I figure the way to make this ~100% effective is to condition myself to always mention attachments as such. But I'd like to add scanning for other key words that might imply an attachment, such as CV or resume as someone posted about above. Or TPS reports.

I see that the effective code in the python script for this is

ATTACH_EXP_STR = r'\battach(?:ment|ments|ing|ed)?\b'

If someone could start me off with how to add additional search terms into this regex I could figure out the rest.

Thanks!



[ Reply to This | # ]
More triggering phrases
Authored by: hamarkus on Apr 05, '06 08:29:57AM

- Here it is:
- Hear are ...
- Have a look at this:



[ Reply to This | # ]
Best productivity add-on of the year so far
Authored by: simonvx on Apr 05, '06 08:53:09AM
Wow, that's really a piece of genius. As opposed to another comment, mine doesn't seem to work in french (attachement, in French, has an extra "e" in the middle, and the scanner probably ignores it because of that). I'd really like to add some english and french words/expressions that could trigger it, as I constantly write in both languages. This plugin has some great potential! Thanks to the author for sharing his talent.

---
Mr Vx

[ Reply to This | # ]

10.4: Avoid sending Mail with unattached attachments
Authored by: Lunkus on Apr 05, '06 09:37:32AM

Very Neat! A couple of suggestions for more work for the programmer to really trick-out this useful plug-in:

1) search the subject line for word roots suggesting attachments
2) perhaps include the word root "include" in the search?
3) Now for the most work-- Make a preference pane that would allow user to
modify the seach strings and other options.

Again, great job and 95% of free perfection is a wonderful thing.



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: Deut3221 on Apr 05, '06 09:59:28AM

Terrific!!!!!

Is there any chance that you can put this on VersionTracker or other tracking services, so that we can know if you update the plugin?

Thank you 100X!!

-s.



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: jhersco on Apr 05, '06 10:28:09AM

This is a great idea! We need the same for us users of Entourage.



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: azraq27 on Apr 05, '06 11:03:34AM

Best plugin ever.



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: shadownight on Apr 05, '06 12:05:31PM

This is really great! I do this all the time!

But I wonder... Would it be too hard writing a version which includes french attachments ("pièce jointe")? From what I understand, it would simply be a matter of adding a word?



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: geppo1982 on Apr 05, '06 12:53:21PM

Hi, thanks for this great plug-in.

I modified it to work also with Italian words: allego, allegato, allegati, allagata, allegate. You can download the modified version by copying and pasting the following url into your favourite web browser.

http://geppo1982.altervista.org/AttachmentScannerPlugin.zip



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: simonvx on Apr 06, '06 07:41:17AM

How did you modify it? Is it something JoeAverage (me) can easily do or it requires some advanced programming knowledge?

---
Mr Vx



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: sjk on Apr 07, '06 01:43:47PM

Maybe some skilled developer will add a preference tab to Mail where expressions to be matched by the plugin can be easily added/deleted instead of being hardcoded.



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: sjk on Apr 05, '06 05:03:35PM

Thanks for creating this plugin, effectively adding Mulberry's missing attachment warning feature to Mail. Nice!



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: markformac on Apr 05, '06 08:34:28PM
I added your great plug-in to my website under Other Applications. Thanks!

---
Mark Brooks


[ Reply to This | # ]

10.4: Avoid sending Mail with unattached attachments
Authored by: macgruder on Apr 05, '06 08:37:20PM

Please find my further comments about this great plugin attached:



[ Reply to This | # ]
Superb!
Authored by: brachiator on Apr 05, '06 10:37:36PM

Oh, this is just a superb little devil! I forget attachments all the time. Just another reason now to wish I had a Mac instead of that pokey old PeeCee at the office (where I forget most attachments). Thanks for this, eaganj!



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: noel_gomez on Apr 05, '06 11:28:57PM

Didn't work for me. 10.4.5 PB-G4

when I create an email I can't edit the body and the accounts drop down does not work.

any ideas?

Thanks.



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: wlwesq on Apr 06, '06 06:23:14AM

Thank you, thank you, thank you. You should put a tip jar or something on your web site. People should shower you with money for this great solution.



[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: fitzgunnar on Apr 06, '06 08:13:42AM

Great software!

I adjusted it for Swedish, which was easy enough thanks to the python script. For those of you who would like to do the same for your favourite language, here is a (fairly) simple trick:

  1. Right-click (or ctrl-click) on the AttachmentScannerPlugin.mailbundle that you put in ~/Library/Mail/Bundles, and select Show package contents.
  2. Navigate to Contents/Resources, and open the file AttachmentScannerPlugin.py in your favourite text editor.
  3. Scroll down a little and find the row that looks like this:
    ATTACH_EXP_STR = r'\battach(?:ment|ments|ing|ed)?\b'
  4. Put a # in front of that row, and then type a new one underneath, without the # and with the attachment keywords in your language, like this:
    ATTACH_EXP_STR = r'\b(?:attachment|attachements|attach|attaches|attached|attaching)?\b'
    (It should all be on a single row.)

    You replace the attach words in the example above with appropriate words from your own language. In my case the file looks like this now:
    #ATTACH_EXP_STR = r'\battach(?:ment|ments|ing|ed)?\b'
    ATTACH_EXP_STR = r'\b(?:här|bifoga|bifogat|bifogad|bifogade|bifogar)?\b'

You can add as many words as you like, as long as you separate them with a vertical bar |. (Listing the words in this way makes the regular expression a bit clumsy, but it is easy to understand. If you like regexp you can simplify as you like.)

It is worth considering for a while which keywords should be included. In my case, I looked in my sent box, and checked a few emails with attachments. I found that I usually used a phrase including the word 'here', and only rarely used the word for attachment or attaching. There will obviously be cases where I use a common word like 'here' without referring to an attachment. If it turns out to be too common, I will have to change the regular expression to something more specific, perhaps 'here is'.

Regards,
/MagnusG!

[ Reply to This | # ]

10.4: Avoid sending Mail with unattached attachments
Authored by: shadownight on Apr 06, '06 02:00:11PM

Thanks Thanks Thanks!!! I've now modified it so it's English-French. Yay!



[ Reply to This | # ]
10.4: SORRY! Bug in the code...
Authored by: fitzgunnar on Apr 06, '06 11:48:11PM
I just discovered that the regexp I suggested is bad. It matches anything and everything. Use this instead:

ATTACH_EXP_STR = r'\b(?:attachment|attachments|attach|attaching|attaches|attached)\b'

(And replace the english words with your own.)

Further, if you (like me) want to use words that include non-american letters (å, ä, ö, è, etc) you need to escape these characters. In my case I had to write h=E4r instead of här

An easy way to find out how to escape the characters is to

  1. type them in a mail message
  2. save the message as a draft
  3. then save it again as a plain text file and select 'original source code' as text format.
  4. Then open the saved message in a text editor and see what the characters look like.

Regards,
MagnusG!

[ Reply to This | # ]

10.4: SORRY! Bug in the code... #2 + message warning customize
Authored by: shadownight on Apr 07, '06 01:35:43PM
Sorry, but the correction you posted is the same as the other one. The correct one I discovered is:
ATTACH_EXP_STR = r'\b(?:attachment|attachments|attach|attaching|attaches|attached|pi=E8ce jointe|pi=E8ces jointes|inclus|incluse)\b'
(the difference is the two backward slashes before the Bs) Thanks a lot for making me put this in my own language!! Note: as you can see above, pièce jointe is pi=E8ce jointe Note2: you can also customize the dialog box message as you want by scrolling down (about half-way) and changing this:
alert.setMessageText_('Message Has No Attachment')
        alert.setInformativeText_("Your mail appears to refer to an attachment, "
                                  "but none exists.  Do you wish to continue?")


[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: skraatz on Apr 06, '06 08:16:11AM
With the help of the original author, I created a German version that checks for English and German appearances of attachment-specific words:

http://www.skraatz.de/apple/anhang-prufplugin-fur-mail

Additionally, the dialog box has been translated to German. :)

[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: zecompadre on Apr 17, '06 11:14:57AM
Added Portuguese keywords to the plugin (keeping the English ones) and changed the dialog message box to display the snippet of text that matched the regular expression...
ATTACH_EXP_STR = r'\banexo(?:s)?|aqui (vai|segue|tem|tens)|junto (envio|segue)|enclosed|attach(?:ment|ments|ing|ed)?\b'
http://hugo.ferreira.net/downloads/AttachmentScannerPlugin_PT.mailbundle.zip
 


[ Reply to This | # ]
10.4: Avoid sending Mail with unattached attachments
Authored by: UniAce on Apr 27, '06 09:20:35PM

Anyone know if this could be adapted to warn when sending a message with a blank subject header?



[ Reply to This | # ]
plugin won't load
Authored by: highphalutin on Jun 04, '09 09:11:17AM

I seem to remember that I used this successfully before. I just reinstalled it (I'm on a Intel Core Duo running 10.5.7) and it won't load. The error message from Console is below. Can anyone help?

6/4/09 9:02:21 AM Mail[5684] AttachmentScannerPlugin has encountered a fatal error, and will now terminate. 
6/4/09 9:02:21 AM Mail[5684] An uncaught exception was raised during execution of the main script:

nosuchclass_error: WebMessageEditor

This may mean that an unexpected error has occurred, or that you do not have all of the dependencies for this bundle.

See the Console for a detailed traceback. 
6/4/09 9:02:21 AM [0x0-0x4c04c].com.apple.mail[5684] Traceback (most recent call last): 
6/4/09 9:02:21 AM [0x0-0x4c04c].com.apple.mail[5684]   File "/Users/noah/Library/Mail/Bundles/AttachmentScannerPlugin.mailbundle/Contents/Resources/__boot__.py", line 23, in ? 
6/4/09 9:02:21 AM [0x0-0x4c04c].com.apple.mail[5684]     _run('AttachmentScannerPlugin.py') 
6/4/09 9:02:21 AM [0x0-0x4c04c].com.apple.mail[5684]   File "/Users/noah/Library/Mail/Bundles/AttachmentScannerPlugin.mailbundle/Contents/Resources/__boot__.py", line 20, in _run 
6/4/09 9:02:21 AM [0x0-0x4c04c].com.apple.mail[5684]     execfile(path, globals(), globals()) 
6/4/09 9:02:21 AM [0x0-0x4c04c].com.apple.mail[5684]   File "/Users/noah/Library/Mail/Bundles/AttachmentScannerPlugin.mailbundle/Contents/Resources/AttachmentScannerPlugin.py", line 35, in ? 
6/4/09 9:02:21 AM [0x0-0x4c04c].com.apple.mail[5684]     WebMessageEditor = objc.lookUpClass('WebMessageEditor') 
6/4/09 9:02:21 AM [0x0-0x4c04c].com.apple.mail[5684] objc.nosuchclass_error: WebMessageEditor 


[ Reply to This | # ]
plugin won't load
Authored by: highphalutin on Jun 04, '09 09:30:23AM

By the way, I've got version 0.9.4 of the plugin -- the only one I could find anywhere on the web. I see some dead links to a version 0.9.7 but can't find anywhere to download it.



[ Reply to This | # ]