serialmail: Creates a series of emails from a textfile template.

Description Usage Arguments Template textfile Data file Author(s) Examples

View source: R/serialmail.R

Description

A plain textfile (.txt) is used as a template to create emails. The textfile may contain any number of arbitrary tags of the form <<tag>>. The template is parsed and the tags are replaced by values taken from a data file. The data is contained in an Excel (.xlsx) or comma seperated value .csv file. Based on these two files an email for each line of the data in the data file is created using the default email program.

Usage

1
2
  serialmail(tfile, dfile, output = "email",
    subject = "subject line", intag = "<<", outtag = ">>")

Arguments

tfile

Path to template file. Must be a .txt file. If no file is supplied a file selection dialog is opened.

dfile

Path to data file. Must be a .xlsx (Excel 2007 or newer) or .csv (German type csv, i.e. semicolon as separator) file. If no file is supplied a file selection dialog is opened.

output

String. Type of output. Default is to generate an "email". Currently not used.

subject

Subject line of email, default is "subject line".

intag

String. The opening signs for tags. The default is <<. Be careful not to use signs that have a special meaning in regular expressions.

outtag

String. The closing sign for tags. The default is >>. Be careful not to use signs that have a special meaning in regular expressions.

Template textfile

The template file contains plain text and tags using double braces as indication for a tag<<tag>>. Any tag name can be used as long as it appears in the header of the data file. An example:

Hello <<name>>, your exam mark is <<mark>>. Best, Mark.

Data file

The data file can be an Excel file. Then the tags without sourrounding braces are the headers, i.e. contained in the first row of the Excel spreadsheet. Only the first spreadsheet is read.

For comma seperated value files the case is the same. The tags without braces are used as headers. Semicolons are used as seperators An example (.csv):

name; surname; mark

Mark; Heckmann; 1,3

Holger; Doering; 1,3

Author(s)

Mark Heckmann

Examples

1
2
3
4
5
6
## Not run: 

 # download the files template.txt and data.csv from github dowload page
 serialmail("template.txt", "data.csv")

## End(Not run)

markheckmann/serialmail documentation built on May 21, 2019, 12:07 p.m.