For shortcuts, scripts, and other apps

One link, and a new message is open in Postfach.

Postfach has a link of its own, postfach://. With it, a shortcut on your iPhone, iPad, or Mac, a script, a web page, or your own app opens Postfach, or starts a new message with the recipients, the subject, and the text filled in. The message waits for you: a link never sends anything.

From Postfach 1.7.3, on Mac, iPhone, and iPad.

What a new message can have.

The fields are a mailto: link's, read the same way. Write each value percent-encoded: a space is %20, a new line %0A, and an ampersand inside a text %26. A plus stays a plus.

The message is written from the account of the mailbox you are in, as New Message is, and you can choose another under From before you send it.

  • to, cc, bcc: one address or several, separated by commas, with a name if you like: Anna%20Keller%20%3Canna@example.org%3E
  • subject: one line
  • body: the text, line breaks included
  • Up to 100 recipients, 1,000 characters of subject, and 100,000 of text. Anything else a link names, a sender or an attachment, is left out

Examples.

The same link works on the iPhone, the iPad, and the Mac.

A shortcut that writes to the same person

In the Shortcuts app, add the action Open URLs with a link like this one. Put the shortcut on your Home Screen, and a message to your team is one tap away.

postfach://compose?to=team@example.org&subject=Weekly%20report

Send what you share to Postfach

A shortcut that takes text from the share sheet: URL Encode the text, put it into a link with the action Text, and hand the link to Open URLs. In any app, Share then starts a message in Postfach with the shared text in it.

postfach://compose?subject=Shared&body=[URL Encoded Text]

A mailto: link, in Postfach

On the iPhone and the iPad, a mailto: link opens the mail app chosen in Settings. A shortcut with Replace Text turns one into a Postfach link: find mailto:, replace it with postfach://compose/, then Open URLs. On the Mac you need none of this: choose Postfach in Mail › Settings › General › Default email reader.

mailto:anna@example.org?subject=Hello
postfach://compose/anna@example.org?subject=Hello

From the Terminal or a script on the Mac

The open command hands a link to Postfach, and so does AppleScript's open location. A script that builds or tests something can leave the message ready for you to look over.

open "postfach://compose?to=team@example.org&subject=Build%20finished&body=All%20tests%20passed."

osascript -e 'open location "postfach://compose?subject=Hello"'

From your own app

Encode every value yourself, leaving only letters and digits as they are. URLComponents leaves an ampersand in a value as it is, which ends the field. To ask first whether Postfach is installed, add postfach to LSApplicationQueriesSchemes in your app's Info.plist and call canOpenURL.

func encoded(_ text: String) -> String {
    text.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? ""
}

let link = "postfach://compose"
    + "?to=\(encoded("anna@example.org"))"
    + "&subject=\(encoded("Build 185"))"
    + "&body=\(encoded("It's on TestFlight & ready."))"

if let url = URL(string: link) {
    UIApplication.shared.open(url)    // NSWorkspace.shared.open(url) on the Mac
}

On a web page

A link on a page opens Postfach for a reader who has it. Everyone else gets nothing, so beside a page for the public, a mailto: link is the better choice.

<a href="postfach://compose?to=support@example.org">Write with Postfach</a>

What a link does not do.

Anyone can write a link, on any page or in any app, so a link only ever fills in a message. You see it, and you decide.

  • It sends nothing: you press Send yourself
  • It attaches no file and does not choose the account a message is sent from
  • It does not read, search, or open your mail
  • It gives the app that opened it no answer back
  • With no account that can send, it opens Postfach and nothing more
  • It does not make Postfach the default mail app on the iPhone and the iPad, where a mailto: link still opens the one chosen in Settings
  • The iPhone and the iPad may ask whether to open Postfach before they hand it a link

Get Postfach.

On Mac, iPhone, and iPad. From the App Store, one purchase for all three.

Download on the Mac App Store Download on the App Store