Modifying a Template before Emailing

I have been using Drafts for a while, but have only just become a Pro user. I wasn’t sure if I needed Pro functionality but I thought that I would give it a go however, I am having a problem on my first project.


I am on a number of meds for which I have to ask my GP practice for a list of repeat medications each month. Some meds I use daily, but some meds such as an inhaler for asthma I only use infrequently. So some meds need to be ordered each month and some only every x months.

My Preferred Solution:

I have created a template (now an Action) with all of the meds listed as well as some text before (a greeting) and some text afterwards (advising them where to send the meds). Each month I would like to run this Action then remove the meds that I don’t need, then the Action goes on to email this remaining text to the GP Practice.

How do I manage to achieve this, as so far my attempts have failed dismally?

I believe to do this, you’d need to use some script actions and maybe even the Advanced HTML Preview features to make it user-friendly. @mattgemmell has created an action group with a bunch of documentation and examples on how to build some things. If you’re comfortable with JavaScript, that’s likely the best approach, if not, let me know.

Thanks for you response. Sadly I am no programmer, so for a person of my skill level I assume that the best solution to the problem would be for me to run the action that displays the list of meds, edit that list, and then use a second action to mail it to the GP practice?

Thanks again.

For the short term, yes I think that would be the best option. If you can share a snippet of the template, and if I get a chance, I’ll see if I can build out the automation you’re looking for. I don’t think it’ll be too complicated and I’ll try and explain it here.

That is a very generous offer. Thank you.

Here is an anonymised repeat prescription request:

Repeat Prescription Request

Hi Folks

Can I have the following items please: -

Med 1
Med 2
Med 3
Med 4
Med 5

Could you please send the meds by internal post to:

My Name
My Department
My Location
My Town
My Postcode


My Name
My NHS No: 12345678

The list would then be sent to an email address:

To add to the complication I use Spark in iOS and Mail in MacOS

Thanks again.

By the way I had heard of Matt Gemmell before, and I plan to follow the link that you provided as I need to see if I can understand/learn about Drafts programming as I now have a subscription.

Take care

I would suggest starting with this example workflow for creating new drafts with templates.

That would allow you to quickly create your draft with the template content, then you can quickly make the modifications you need, and use standard actions for Mail or Spark to send the mail.

You could save a few more steps by having dedicated Mail actions that already have the recipient email assigned, and that use “after success” to archive/trash the draft after sending the mail.

Thank you

I have done part one now, and I have the standard actions for Mail set up already, but need to go to my iPad the set up an Action for Spark. If I have understood correctly, this remains as a two step action.

There are lots of ways it could be streamlined, but all involve code. You should have it prompt you to select from a list of the meds, fill that in a template, open the email ready to go - that’s all possible, but more involved.

Thank you for the input.