Very often in production there is a task to send several letters with an attachment in pdf format. It can be not only invoices or invoices, but also notices or invitations, personal messages about promotions and the like. Of course, even a hundred other people were lying in a notebook in the notebook. The text of the letter can be both static and variable. And then running around the whole Internet with the question of how to do it ...
Let's take as a basis the letter of the following content

')
The text of the letter body will not change during mailing, except for the text in italics, respectively, the sender will also be one, but there will be several recipients
Let's prepare a database of addressees in xml format, I will not explain what the title means there, I think that an experienced reader will figure it out himself. I will only note that the format is easily changed for your data that is typed in according to your individual template.
So, the recipients database (the original xml files are located at the end of the link. You can download and change them as you wish)

As a
model, we have a set of fields Date, Company Name, Name, Address, City, Telephone
<Date>Friday, 23/05/2019</Date> <CompanyName>Qualcomm</CompanyName> <Name>Lucas</Name> <Address>711-2880 Nulla St.</Address> <City>Mankato Mississippi 96522</City> <Phone>(257) 563-7401</Phone>
Download the demo version of
FastReport and open
Letter_Blank.frx
In this case, the date of sending the letter in the upper right corner is pulled from the xml file, so we replace this text with

Which means that the text will drag from the Data field of the Letters table.
Similarly, we make a similar substitution with other dynamic values (they are highlighted in red for clarity)

You can read more about these replacements in the
Letter.frx file
.Run the report and get

We print and send. It is not difficult to write a program that will do the whole set of such operations and send it by e-mail, this will be discussed another time)
github.com/ufocombat/Letters