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


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: 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 | # ]