knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(EmailTemplate)
The EmailTemplate Shiny app provides an easy-to-use load-save-and-click interface to create and load Email Templates.
After opening RStudio, the application can be started with just a few lines of code. In general, you'll want to load the latest release from CRAN:
install.packages("shiny") library(shiny) install.packages("EmailTemplate") library(EmailTemplate) EmailTemplate()
When you open the app, you are taken to the User Guide tab which contains a concise version of the current vignette. At the end of the user guide, you will also find contact information in case you have questions regarding the application, experience issues, or have suggestions for improvement.
{width=40%}
Notable, the user guide is a dropbox-shared pdf and can, hence, only be viewed when opening the application in the browser.
{width=50%}
After opening the app, you will typically follow the workflow below. In short, you will load and save input data, tweak input choices and content, and then copy the resulting email template.
{width=70%}
The work flow lines up with the toolbar panels.
{width=60%}
More information about each step in the process is described below.
First, you will need to create and save an empty excel file as a *.csv file. When you open the app, you should be able to see a side panel that contains some default topics to choose from. At the top of the side panel you should be able to paste the path to your excel file in the field box titled 'Inputs Location'. Importantly, you must paste the path without parentheses, otherwise the application will not be able to find the file.
{width=30%}
In the sidebar panel, you can see and edit various input choices (see a picture of the complete sidebar panel below).
{width=20%}
The first input you can edit is titled 'Salutation'. The salutation addresses the person you are sending the email to. By default, the salutation is set to 'Dear...,'. You can insert the recipient's name after the comma or insert a different salutation.
{width=25%}
The second input you can select from is the 'Choose opening line' input field. The opening of your email introduces the response type of the email. There are four default topics to choose from. For instance, you would pick the opening line 'reply' if you are responding to a reply of the recipient in question (see a picture of the default choices below).
{width=35%}
If you cannot find what you are looking for, you can enter a new choice of the opening line in the text input field. You can add it to the default choices by clicking the 'Add to choices..' button (see a picture of the input field and button below).
{width=35%}
The third input you can choose from is titled 'Choose topic'. This input field refers to the overall topic of your email. In essence, it will set the topic for the main body of your template. The body of an email normally elaborates on the purpose of the email and contains detailed information. Again, there are four default choices (see picture below).
{width=35%}
You can complement those choices by entering a new topic in the empty text field and add it to the set of choices via the 'Add to choices..' button.
{width=35%}
The fourth and fifth inputs you can choose from are titled 'Choose day of week' and 'Choose time of day' respectively. You can select the present day of the week and the time of the day. Doing so will compose a day and time-appropriate greeting line (see pictures below).
{width=35%}
{width=50%}
The final inputs to edit are titled 'Closing Line' and 'Insert your Name' respectively. You can sign-off your email with a closing line and seal it with your name. The popular sign off 'kind regards,..' is set as a default, but feel free to insert a different closing line.
{width=35%}
You can save the input data and load it the next time you are using the application via the buttons at the bottom of the sidebar panel. To do so, make sure that the correct path to your excel file is displayed in the Inputs Location field. The button 'save inputs' will allow you to export your inputs to the excel file, while the button 'load inputs' will allow you to import your inputs from the excel file.
{width=30%}
Importantly, the excel file cannot be open while saving or loading inputs. If the excel file is open during the export-import processing, the following error will show:
{width=50%}
After saving, loading, and selecting your choices, navigate to the Content Editor tab to customize the content of the opening line and topic you selected in the side panel.
{width=50%}
Once again, you will need to create and save an empty excel file to load and save your input for later usage of the application. Once you have done that, you will need to paste the path to your excel file in the Inputs Location field at the top of the Content Editor tab (see picture below). Again, you need to paste the path to the excel file without parentheses.
{width=40%}
After inserting the path to your excel file, you can customize the content of your email template. For instance, if you chose the opening line 'reply', the first input text field should be titled 'reply'. You could insert something like "Thank you for your reply." in the input field and export it to your excel file (see the red arrows below). Click the 'save inputs' button at the bottom to export your customized input (see orange arrow below) or click the 'load inputs' button to import previously saved inputs (see blue arrow below). Following you should be able to recreate the customized inputs. The input area for the topic of the email is larger to allow you to write more text (see yellow arrow below).
{width=35%}
Once you have customized or loaded your content from previous sessions, you can proceed to the Template tab. Here you can view what the complete email template looks like. If you are satisfied with the result, you can copy it and insert it into your email draft. An example template is displayed in the picture below.
{width=50%}
What should your Excel table look like?
If you save the inputs of the side panel as they are when opening the application, your excel table should look like the one below:
{width=35%}
If you have selected 'reply' as an opening line and saved the input 'Thank you for your reply', your excel table should look like the one below:
{width=35%}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.