Sending small attachments with Mail Drop

mail_apple
email

#1

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?


Best Macro List
#2

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)



Macro Trigger Option Using Long Press of Hot Key [Example]
#3

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?


#4

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.


#5

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.)


#6

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:


#7

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).


#8

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.


#9

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:


#10

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.


#11

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


#12

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...


#13

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.


#14

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