The mailmerge data is submitted in a file in CSV format, encoded in the current locale. The normal separator between fields is the comma, but tabs and semicolons are also accepted.
If there are no variables in the template, the data file should contain only one column for the recipient address, with one line per recipient. A header line is not expected to be present.
On the other hand, if there are variables in the template, there must be a CSV header line at the very beginning of the file, with the column names matching the names of variables for the merge process. Also, the first column is assigned by convention to the recipient address. In the examples below, the name "email" is given to this column.
Here is an example of a simple data file containing two records, with the variables title
, firstname
and name
in addition to the mandatory email
field.
email;title;firstname;name john.doe@example.org;Mr;John;Doe jane.doe@example.com;Ms;Jane;Doe
Fields may contain newlines, when they're enclosed in double quotes. Here is another valid data file, with two records and a postal address field spanning multiples lines:
"email","name","postal address","country" "s.sosa@example.org","Daniela Sosa","Casilla de Correo 432 Correo Central C1000WAM Capital Federal","ARGENTINA" "w.heisenberg@example.com","Mr W Heisenberg","U 235 201-203 BROADWAY AVE WEST BEACH SA 5024","AUSTRALIA"
Double quotes in the data itself must be represented as two successive double quotes.
Once the mailing is stored in the database, the data files and template files if any can be discarded, since theirs contents are stored into the database as part of the mailing data. They will be later removed from the database if and when the mailing gets deleted.