Sending Small Attachments With Mail Drop

I really hate email attachments and prefer linking to uploaded files instead. In this regard Yosemite has introduced a really convenient feature, called Mail Drop.

The problem with this is the file size. Not the allowed maximum size (5GB) but the minimum size threshold, which usually is 20MB (but may depend on the mail provider).

That means for attachments < 20MB you are still dependent of DropBox or similar services.

The good thing is that you can adjust the minimum size for Mail Drop with defaults write com.apple.mail minSizeKB. The annoying thing however is that the size will auto-reset to its default 20MB after some time.

The problem goes away if we couple the sending of an email with a KM macro that sets the minimum threshold immediately before sending.

A good hotkey trigger seems to be ⇧⌘D which is the same that we use in Mail app for sending mails:


Set Mail Drop Minimum Size Before Sending Mail.kmmacros (8.0 KB)


This macro is kind of brute force. Does anybody know how to set the threshold persistently?

1 Like

Time for a new version. The macro has gained some options:

Formerly the macro always used a fixed value for the minimum MailDrop attachment size.

The new version still behaves this way if you want so. Just hit ⇧⌘D for sending a mail, as before.

And the main purpose of the macro is still the same: it assures that also attachments smaller than 20000 KB will be sent with MailDrop.

The new thing is when you make a long key press (press ⇧⌘D and rest a bit longer on the D key) you will get a user prompt. (Long key press inspired by the Copy All macro.)

Purposes of the user prompt

It gives you information:

  • Currently set MailDrop minimum size (as read from Mail’s preferences)
  • Your preferred default minimum MailDrop size

It lets you


  • Set a new default minimum size
  • Set a different minimum size just for the current mail to be sent (Uncheck “Make new default”)
  • Effectively disable MailDrop for the current mail (Click the “No MailDrop” button or press ⌘N)
  • Effectively disable MailDrop for future mails and for all accounts (Enter a high value like 99999 with “Make new default” checked)
  • Reset the size to Mail’s default (Enter 20000 with “Make new default” checked)

On the different values

The macro uses three different values for MailDrop’s minimum attachment size:

Currently set

For informational purposes only.

This is the minimum attachment size as read from Mail’s preferences when the macro is launched.

Mail app has the habit to reset the size to its innate default of 20000 KB in unpredictable intervals.

User default

Your preferred minimum attachment size for MailDrop. When sending a mail with ⇧⌘D (also without user prompt) this value will be used. At the very first macro launch, or if you have destroyed the variable, this will be set to 3000 KB.

You can set the default in the user prompt.

User-entered value

This is the value you can enter in the user prompt; it will actually be used for the current mail. If you have “Make new default” checked it will become default.

What means “default”?

The default size is only guaranteed when you use ⇧⌘D for sending a mail. If you send a mail by clicking the Send button instead, the macro will not be launched. This means, Mail will use the minimum attachment size that is currently set in its preferences. This may or may not be your entered default value. It depends if Mail in the meantime has reset the value to its 20000 KB or not.

So if you use this macro it’s a good idea to make it a habit sending mails with ⇧⌘D, if not already done.

Why not using a the same minimum size for all mails?

Usually I have set my minimum size to 1000 KB or so. That is, every attachment > 1MB takes the way via MailDrop.

However I have some clients who have difficulties with downloading the attachment from the Apple server. In these cases now I can invoke the user prompt and temporarily increase the minimum size to a value that disqualifies the attachment for MailDrop. (The “No MailDrop” button does this.)

This has basically the same effect as going to Mail’s Preferences > Accounts > [Choosing the account] > Advanced > Disable ‘Send large attachments with Mail Drop’. And reenabling it again afterwards. (This setting doesn’t seem to be accessible with AppleScript, at least not easily.)

Besides that, I sometimes change my mind on what is a good minimum size for MailDrop. Now I can change my default quickly, without opening the KM Editor.

Other changes

Due to the user prompt the macro now has a basic plausibility check on the entered value to prevent me from messing up the Mail plist file.


Set MailDrop Minimum Size Before Sending Mail (With Prompt).kmmacros (18.8 KB)


2 Likes

Hi Tom,

Is there any way to ensure this macro will be working without the CMD + Shift + D shortcut?

We work together in a team, where we also use reply’s (to all), forwards etc. So the “New mail” keystroke will not always be sufficient. And not everyone uses keystrokes. So is it in any way possible to set the minimal Mail Drop document size to say 2MB when opening the Mail application?

Of course. The core of the macro is a simple command line:

defaults write com.apple.mail minSizeKB -float $KMVAR_SMMS__Set_to_KB

If you always want 2MB as the minimum MD size, you can as well set it to:

defaults write com.apple.mail minSizeKB -float 2000

As trigger you can chose:


The (potential) problem is:

Mail.app decides to reset the minimum size to the default 20000KB in unpredictable intervals.

It may happen that your custom value remains active for days, even across OS restarts. But it may as well happen that your custom value is reset the minute after you’ve set it.

That’s why I decided to couple it with the send command. This assures 100% that your custom value is used for the mail to be sent.

PS:

Before I’ve written the macro I made a little Service Workflow, which basically does the same, but independently of any keystrokes in Mail. Maybe it suits you better.

You find it on my blog.

But the caveat is the same as described above: it doesn’t guarantee that your current mail will be sent using your setting (unless you’ve set it via the Workflow immediately before sending.)

Hallo, erstmal danke fĂŒr die klasse Idee. Bin leider noch nicht ganz so fit in KM. Könntest Du das Makro auch fĂŒr die deutsche macOS-Anwendung zur VerfĂŒgung stellen? Habe zwar “Send” durch “Erneut senden” ersetzt, doch es klappt einfach nicht. WĂ€re Dir echt dankbar :slight_smile:

Ich denke, die Lokalisierung ist so:

en de
[menu title, 2×] Message E-Mail
[menu item, 2×] Send Senden
[menu item, 2×] Send Again Erneut senden

‌
Einfach durch die deutschen Begriffe ersetzen; auf Groß-/Kleinschreibung achten. Jeder Begriff kommt 2× vor, wenn ich mich nicht verzĂ€hlt habe. Also insgesamt 6 Ersetzungen. Du musst wahrscheinlich die Actions aufklappen, damit du alles siehst.

Zum Aufklappen einer Action auf die kleine Triangel klicken:

Mit dem MenĂŒtitel Message/E-Mail bin ich mir nicht ganz sicher. Ich hab gerade kein deutsches System hier zum Nachschauen. Aber wenn du eins hast, dann siehst du’s ja oben in der MenĂŒleiste (viertes MenĂŒ von rechts).

Vielen vielen Dank fĂŒr die schnelle Antwort. Hatte in den aufklappbaren MenĂŒs schon mal durchgeklickt. Werde es gleich morgen/spĂ€ter probieren. Werde mich dann mal melden ob es geklappt hat.

Habe es zum Laufen bekommen :+1: Hatte einmal “E-Mail” und “Erneut senden” ĂŒbersehen. Ist das korrekt, dass mir immer die zuvor gesendete Mail mit Inhalt/Sender/EmpfĂ€nger angezeigt wird und ich das Alles manuell löschen muss?
Danke Dir nochmals fĂŒr Deine Hilfe :clap:

I’ll answer in English, since this may be of interest for non German-speaking readers, too. And, after all, this is an English-speaking forum.

I think you misunderstood the usage concept:

The macro takes over the original ⇧⌘D shortcut. ⇧⌘D in Mail (with or without the macro) does two things:

  • If any sent/received message in the messages list is selected ⇧⌘D acts as “Send Again” → the message is opened in a new message composer window. You now can edit the message and send it (“again”).
  • If a message composer window is frontmost (for example you are writing a new message) ⇧⌘D acts as “Send” → the message is sent.

In the first case the macro simply forwards the shortcut to Mail, i.e. the macro does nothing.

Only in the second case the macro actually does its thing: it sets the MD size and then tells Mail to send the message.

The behavior you are describing is the normal behavior when you press ⇧⌘D with an old message selected in the messages list. It would be the same if you don’t have the macro installed.

In short: With the macro installed you don’t have to learn any new shortcuts; just continue to use Mail as you always did:

  • To send an old message again select it in the list and press ⇧⌘D → composer window opens (Macro does nothing) → edit the message → press ⇧⌘D to send it (Macro sets the MD size in the background, and then sends the message)
  • To send a new message press ⌘N → composer window opens → write the message → press ⇧⌘D to send it (Macro sets the MD size in the background, and then sends the message)

As mentioned in the description, to adjust the MD min. size value make a long-press ⇧⌘D.


If you don’t like to use keyboard shortcuts in Mail you can also try the Service Workflow which is mentioned above. Go here (or here for the German page) and scroll down to “Download”. I recently improved the Workflow and updated it for Sierra.

Thank you very much for your quick reply and comments. Have it understood now :+1:

Hi Tom, great work! But one Problem: The Workflow works fine here, but the change of the minimum-size has no effect in Mail. When I „ask“ in the Terminal about the actual value, it indeed changed. But Maildrop is not used. Of course I activated it :wink: Do you know if anything changed in the last years? I googled „Mojave minSizeKB“ and other terms but did not find any hint...

Hi Jack,

thanks for your feedback.

Honestly, I haven’t used Mail Drop in the last year or so.

Thanks to your question, I —briefly— tested the Workflow now, and indeed it doesn’t seem to work anymore.

I noticed one thing:

When I ran the Workflow, the minSizeKB variable by default was not present in UserDefaults (i.e. in Mail’s plist file). IIRC, this was never the case at the time when I’ve written the Workflow and the KM macro. (Otherwise my Workflow would never have worked correctly, because it starts with reading the variable.)

What I think is that Apple has removed the variable from UserDefaults. Maybe it’s a server-side setting now, or it is just a hard-coded, unchangeable value now, I don’t know.

Of course, we can still write the variable and a value to UserDefaults (with defaults write [
]), but if the variable is no longer used by Mail, then it will have no effect at all.

Let me know if you find out anything more.

Hi Tom,

thank you for answering and spending time with finding this out! So I will look around for a solution. If I find out something I will comment again.

Have a nice monday!

Jack

Any updates on this? The defaults command doesn't work in Catalina.

Thanks, James.

To my own confusion, contrary to what I said there, the macro (from this post) still works fine for me with macOS 10.15.2, including the defaults command.

I have done a quick test with a 3MB mail attachment, with and without reducing the default minSizeKB value via my macro.

But probably I’m missing something right now, since I haven’t dealt with Mail Drop in a long time.
Can you tell me what exactly does not work? Do you get an error? Is the value not respected by Mail?

BTW, welcome to the forum :slight_smile:


PS:

A screenshot of the 3.7MB attachment, received via MailDrop (minSizeKB set to 1000 when sending):

12-pty-fs8

Hi Tom, thanks for the reply. I'm not actually using KM, just the defaults write command.

Running macOS 10.15.3.

Tried both:

% defaults write com.apple.mail minSizeKB 10000

and

% defaults write com.apple.mail minSizeKB -float 10000

Restarted Mail.app after each one. But when I send an 18MB email Mail Drop does not get used.

The KM macro just uses the defaults write command doesn't it? So the command should work for me?

Thanks, James.

Yes, that’s the problem. If you restart Mail the value will likely be reset to the default 20000. It may even happen that it will be reset without having restarted Mail, IIRC.

That’s one of the reasons that I wrapped the defaults shell command in a KM macro and coupled it with the Send Message shortcut. So it’s always assured that your value is applied when sending the mail.

See the last part of this post.

So, if you don’t use the KM macro: Write your message with the attachment in Mail, set your minSizeKB value via Terminal and send your mail as soon as possible. (Well, you don’t have to send it within seconds, but don’t wait hours. And without relaunching Mail in-between!)

PS:

If you don’t have KM and don’t want to always set the value manually, you can also make your defaults script execute periodically via launchd, let’s say every 3 hours or so, and after system reboots. This way it will be very likely that your custom value is set when you send a mail. (But not 100% guaranteed, of course.)

If you change a setting it still works as of May 20, 2021 running macOS Big Sur v. 11.3.1:

Apple Menu > System Preferences > Security & Privacy > Privacy (fourth tab to the right along the top)

Then:

(1) Click the lock in the lower left corner of the pane to allow changes,

(2) Enter your password, and finally

(3) Tick the box next to “Keyboard Maestro” (or if it’s not in the list, click the plus icon and add “Keyboard Maestro” and then tick the box).

I hope this helps someone these year(s).

Later lol