====== Set up E-mail templates ======
===== What are e-mail templates? =====
With e-mail templates you can put your own text or logo in front of and / or behind the actual content of the e-mail. The template can also use CSS to change the layout of the e-mail, such as font size, font color or background color. You can also deposite pictures of your website e.g. the club logo. Also other texts of the web page or to the association can be written within the template. If the user creates an e-mail, the content of the template for this e-mail will be added before sending this e-mail. The recipient of the e-mail then sees the merged result from the created text of the user, as well as the additions from the template.
===== How do I create e-mail templates? =====
Starting with Admidio Version 3, e-mail templates can be used. These are stored in the folder **adm_my_files/mail_templates**. If this folder does not exist, then you should create it.
The e-mail template is defined via an HTML file. In Admidio Version 3, only one file named **template.html** can be used. //From Admidio Version 4// you can create several templates and choose the name freely. It always has to be a file with the extension **.html**. Even if you do not want to use HTML emails, you need to create an HTML file, but then just add text there. //From Admidio Version 4// you can now select in the settings of **messages** at **e-mail template** the file you just created.
{{:en:2.0:messages:settings_email_template_en.png?400|Preferences > Messages}}
Within the html-file you can add further content with [[de:2.0:e-mail-templates#wie_baue_ich_parameter_in_die_vorlage_ein | predefined parameters]]. Mandatory is the parameter **#message#**, which adds the actual content of the e-mail. You can then place this parameter in your template as you like.
Example of an e-mail template:
This is a sample text that precedes the actual content of the e-mail.
Now follows the actual content:
#message#
At the end of the e-mail is this text.
===== How do I implement parameters in the template? =====
Within the html template you can use different parameters, which will then be replaced by the corresponding content when sending the e-mail. Put the parameters anywhere in your template.
Example of a template with different parameters:
#sender# sent to #recipients# from #organization_website# this message:
#message#
The following parameters are available:
^ Parameter ^ Minimum version ^ Description ^
| #message# | 3.0 | The content of the e-mail. :!: **This parameter must be used in each template**. |
| #sender# | 3.0 | Please only use in version 3.x. First name and surname of the sender. |
| #sender_name# | 4.0 | First name and surname of the sender. |
| #sender_email# | 4.0 | E-mail address of the sender. |
| #sender_uuid# | 4.1 | The unique UUID of the sender. |
| #receiver# | 3.0 | Please only use in version 3.x. Recipients of the e-mail. Roles and individual users. |
| #recipients# | 4.0 | Recipients of the e-mail. Roles and individual users (for sending as BCC only the number of individual users)\\ Example: //Members, Administrators and 3 individual users//. |
| #organization_name# | 4.0 | Name of the organization. |
| #organization_shortname# | 4.0 | Abbreviation of the organization. |
| #organization_website# | 4.0 | Website of the organization. |
===== How do I use templates with multiple organizations? =====
If you have deposited several organizations in Admidio and now want to refer to the respective organization in the e-mail template under which the user has created the e-mail, then you have //as of Admidio Version 4// two different possibilities.
If you just want to put the organization's name or website in the template, you can use [[de:2.0:e-mail-templates#wie_baue_ich_parameter_in_die_vorlage_ein | the parameters]] **#organization_name#**, **#organization_shortname#** or **#organization_website#**. Deposite it anywhere in the template. As soon as the e-mail is created, it will be replaced by the respective organizational data.
If you also want to place a logo, lettering or a color scheme of the organization in the template next to the name, you will need to create separate HTML templates. There you can then adapt via CSS or the integration of images, the template to your imagination and save it under a separate name, for example **template-organization-1.html** in the folder **adm_my_files/mail_templates**. Now go into the settings of the respective organization and select under the settings of the **messages** at **email template** the template of that organization.