Sending Mail with Drafts
Drafts is a great place to, well, draft emails. Using Drafts allows you to use a convenient, configurable editor for a consistent writing experience and it’s easy to send email directly within the app – or by integrating with third party Mail clients. Even write with Markdown and send as rich HTML email. This article covers some of these basics of using email in Drafts and different methods available.
You are reading: I would like to view my drafts in the preview pane, not as a popup
Mail Action Step
Drafts ships with a default Mail action, in the “Basic” action group. This action is configured to use the first line of the draft as the subject line, and the remaining text as the body of the message. When used, a Mail mesage will pop up with the text already filled in. You add a recipient and tap “Send” and your mail is on the way.
On iOS, it will use APIs to send via Apple’s Mail app. On the Mac, it uses mailto: URLs to open a message in your default email client.
This is only the beginning of what is possible with the Mail action step. Multiple actions can be set up using Mail action steps, each configured to have pre-defined To, CC & BCC recipients, stock subject lines, or body templates which automatically add signatures or other reused content and formatting. So it’s easy to set up, for example, a group email action to send to your project team or family.
Configuring Mail Action Steps
If you are new to actions, you can get familiar with the basics of editing actions in our Create an Action screencast, that’s a little beyond this article, but below shows a sample configuration of a Mail action step.
mail-action816×822 117 KB
There are more detailed explanations of the fields in the Mail action step documentation. Each of these fields support Drafts template tags, including the recipient fields, so it is possible to dynamically insert content.
The basics are:
Recipient fields (To, CC, BCC): These fields can each have one or more email addresses (separated by commas). If values are configured for these fields, they will be pre-filled in the Mail window that opens, leaving you only to tap “Send” to finish the email. Use the (+) button to select email addresses from your contact list.Advanced Options:Send as HTML: If on, this will treat the output of the template as HTML and create a rich-text email. This means that the template should have HTML tags in it. This is typically used along with Markdown, see section below for details.Send in background: Used to send the email via web service without the requirement of opening a preview of the message. Because these message come “From” a generic address, it’s best for action which email to your own email address as a reminder, or similar.
Markdown is a text-to-HTML conversion tool that lets you write in simple plain text markup and easily convert it to HTML. Drafts has great Markdown support, and it works nicely with Mail steps to create rich-text formatted emails.
mail-markdown816×666 93.7 KB
To get started, install the Markdown Mail sample action from the Action Directory. This action uses a standard Mail action step, with two configuration changes:
The “Send as HTML” option is enabled.The body template is changed to %%>%%. The double-percent syntax is a feature of the that tells Drafts to treat any text between the double-percents as Markdown, and convert it to HTML.
Using this step, it makes it quick and easy to send professional, rich-text email without a lot of fiddling with text selections in Mail.app.
Because this relies on APIs that are not available on macOS, the basic implementation of Markdown Mail is not compatible with the Mac. We do offer a free helper app that enables this functionality on the Mac, called Mail Assistant. If you are interested in sending Markdown mail on the Mac, get more information and sample actions in our Mail Assistant article.
With the introduction of iOS 14, it is now possible to have third party email clients configured as your default application to handle mailto URLs. Because of this change, it might be desirable to have mail actions which explicitly use the mailto URL structure to send on both iOS and Mac.
We have posted an example mailto-based action.
The biggest downside to this approach is that you must leave Drafts to complete the sending process.
Gmail and Outlook Action Steps
In addition to the “Mail” action step, there are dedicated steps available to send background email via Gmail or Microsoft Outlook.com/Live/O365 accounts. These steps are configured very similar to the Mail step as covered above, but they do not open a window before sending the email. As a result these action steps must include at least one valid recipient email to send properly.
The primary advantage of these steps is to allow a background email (without additional “Send” popup step) to be sent “From” your actual address with one of these services.
Third Party Email Apps
In addition to direct Mail support, Drafts can work with many third-party email clients directly. There are two common ways to send email using third party iOS email clients: Share extensions and URL schemes.
Many email client apps provide share extensions that can accept text and can be used via the Drafts Share action. When provided, these extensions will generally allow you to send an email, and use the text as the body of the email – requiring you to fill in the recipients and subject – just as the built-in iOS Mail share option.
Many popular email client apps also provide support for integration via custom URL schemes. The format of the required URLs and the features they support varies between clients, but most allow sending subject and body text. Some example actions are available in our Action Directory for most popular third party clients, like:
This introduction doesn’t go deep enough to talk about scripting, but be aware that feature described above can also be accessed via the Mail script object in script steps – open all sorts of advanced possibilities. Scripting interfaces are also available to send via Gmail and Outlook accounts directly – allowing use cases like looping over a list of email addresses and sending the same email individually to each as a “To:” recipient.
Can I send in the background using my own Mail accounts?Yes, if you use Gmail or Outlook integrated accounts. If a mail step uses the “Send in Background” option, it is sent using a web service. Mail.app does not support background sending.
Can I pre-configure the “from” address in the Mail window if I have multiple accounts?No, sadly. This is not an option provided by Apple in the APIs that work with Mail.app. It can be changed in the window that pops up by tapping on the from line.
Other Sample Actions
A search for “Mail” in the Action Directory will always turn up some other interesting ideas for customizing mail actions – a few choice examples: