sg_mail will automatically parse valid configuration files of all extensions within your TYPO3 instance.
Inside the file you have mandatory and optional settings you can define:
**Mandatory**
#### Mandatory
- extension_key
Needed to associate this template with the appropriate extension,
-**extension_key**: Needed to associate this template with the appropriate extension,
-**template_key**: A unique identifier of your template.
-**description**: A short description of your templates usage, displayed in the backend template editor. This should be a **language label**
-**subject**: The default mail subject used for this Template. Here you can also provide a language label.
-**markers**: An array of placeholder variables.
Are dynamically replaced by the appropriate values. If you don't want any markers, provide an empty array.
A marker needs to be structured as follows:
- template_key
A unique identifier of your template.
-**marker**: The variables name used in your template.
-**type**: Here you can specify the variable type by using one of the constants in the **\SGalinski\SgMail\Service\MailTemplateService** class.
-**value**: An example value of this marker. Also used for previewing your mails in the backend module.
-**description**: A short text describing the purpose of this marker.
- description
A short description of your templates usage, displayed in the backend template editor. This should be a **language label**
#### Optional
-**template_path**: You can provide a path to your mail template that differs from the default path with this setting.
- subject
The default mail subject used for this Template. Here you can also provide a language label.
#### The template folder
- markers
An array of placeholder variables. Are dynamically replaced by the appropriate values. If you don't want any markers, provide an empty array.
A marker needs to be structured as follows:
- marker
The variables name used in your templates.
- type
Here you can specify the variable type by using one of the constants in the **\SGalinski\SgMail\Service\MailTemplateService** class.
- value
An example value of this marker. Also used for previewing your mails in the backend module.
- description
A short text describing the purpose of this marker.
**Optional**
- template_path
You can provide a path to your mail template that differs from the default path with this setting.
**The template folder**
If not overwritten in your configuration file, the default location for your extensions templates is **ext/sg_example/Resources/Private/Templates/SgMail/{TemplateNameInUpperCamelCase}**.
Inside this folder you need a folder for every template you want to register. The name of the template file itself should be **template.html**
**Example:**
#### Example:
Your configuration file for the template "confirm_mail" should be located at **../Configuration/ConfirmMail.php**.
A possible ConfirmMail.php file could look like this:
The mail queue holds all the mails that have been sent or should be sent in the future. You can view the mail queue in the backend module and interact with the entries.
The mail queue holds all the mails that have been sent or should be sent in the future.
You can view the mail queue in the backend module and interact with the entries.
You can set the priority (setPriority function of the service) for your mails with the constants
of the **SGalinski\SgMail\Domain\Model\Mail** class. With the Flag **ignoreMailQueue** you can switch between
queueing your Mail(false) or immediately(true) sending it.
queueing your Mail(false) or immediately sending it (true).
* PRIORITY_LOWEST
* PRIORITY_LOW
...
...
@@ -146,13 +135,14 @@ queueing your Mail(false) or immediately(true) sending it.
* PRIORITY_HIGH
* PRIORITY_HIGHEST
The higher the priority, the more likely the mail will get send immediately (depending how "busy" the MailQueue is).
The higher the priority, the more likely the mail will get sent immediately (depending on how "busy" the MailQueue is).
#### The command controller
To enable the mail queue functionality you need to configure the **SendMailCommandController**.
Go to your scheduler module in the TYPO3 Backend and setup a scheduled CommandController task. Chose the **SgMail SendMail:runSendMail** CommandController command and supply a frequency in seconds or [cron](https://en.wikipedia.org/wiki/Cron) format.
Go to your scheduler module in the TYPO3 Backend and set up a scheduled CommandController task.
Choose the **SgMail SendMail:runSendMail** CommandController command and supply a frequency in seconds or [cron](https://en.wikipedia.org/wiki/Cron) format.
For more information on the TYPO3 scheduler extension read its [manual](https://docs.typo3.org/typo3cms/extensions/scheduler/Index.html).
...
...
@@ -161,24 +151,26 @@ For more information on the TYPO3 scheduler extension read its [manual](https://
When you provide no language to the MailService API, the default language of the TYPO3 instance is used.
This happens also if the given iso code of the language is not known (inside the **sys_lang** table).
In your template editor you have automatically all languages of your page shown.
In your template editor you automatically have all languages of your page shown.
### Example
finishers {
1 {
class = SGalinski\SgMail\Service\FormhandlerFinisherService
config {
checkBinaryCrLf = message
template_key = your_template
extension_key = extension_key
to_address = admin@sgalinski.de
from_address = info@sgalinski.de
from_name = sgalinski.de
ignore_mail_queue = TRUE
}
}
}
```Typoscript
finishers {
1 {
class = SGalinski\SgMail\Service\FormhandlerFinisherService
config {
checkBinaryCrLf = message
template_key = your_template
extension_key = extension_key
to_address = admin@sgalinski.de
from_address = info@sgalinski.de
from_name = sgalinski.de
ignore_mail_queue = TRUE
}
}
}
```
## The Backend Module
With this extension comes a new module in the "WEB" section of your TYPO3 Backend.
...
...
@@ -209,34 +201,40 @@ With the **Mail Queue** mode, you can see the current content of your mailing qu
<br>
<imgheight="20px"width="20px"src="https://camo.githubusercontent.com/4b1188209e740e17a4ec0cd6583425696809017b/68747470733a2f2f7261776769742e636f6d2f5459504f332f5459504f332e49636f6e732f6d61737465722f646973742f616374696f6e732f616374696f6e732d646f63756d656e742d766965772e737667"> View the content of this mail
Additionally you can now filter the mail queue or export it to a csv file.
Additionally, you can now filter the mail queue or export it to a csv file.
## Blacklisting templates
It is possible to exlude certain templates for all or specific domains. Excluded templates are not shown in the backend module
and their mails are never send.
Mails from these templates are still logged and you can search for them in the backend module.
It is possible to exlude certain templates for all or specific domains.
Excluded templates are not shown in the backend module, and their mails are never sent.
Mails from these templates are still logged, and you can search for them in the backend module.
### Blacklisting templates for all domains
In the extension configuration setting **general.excludeTemplatesAllDomains**, you can specify which templates should be excluded for all domains with a comma seperated list.
Example:
sg_comments.approved, sg_comments.declined
```
sg_comments.approved, sg_comments.declined
```
The templates "approved" and "declined" of the extension sg_comments are blacklisted for every domain.
### Blacklisting templates for certain domains
In the extension configuration setting **general.excludeTemplates**, ou can specify which templates should be excluded for which domains with a Semicolon separated list of comma separated list.
The comma seperated lists contain the page id and the templates to be excluded.
The comma seperated lists contain the page id, and the templates to be excluded.
The template "approved" of the extension sg_comments and the template "welcome" of the extension sg_example are blacklisted for the domain with the page id 1.
The template "approved" of the extension sg_comments, and the template "welcome" of the extension sg_example are blacklisted for the domain with the page id 1.
The template "declied" of the extension sg_comments is blacklisted for the domain with the page id 10.
The template "declined" of the extension sg_comments is blacklisted for the domain with the page id 10.
If the page ids are missing or not correspond to a site root, the configuration has simply no effect.
...
...
@@ -245,21 +243,21 @@ In the backend module mode "Queue" you can filter for "Blacklisted" mails. Note:
## Known Facts
### Countries aren't respected yet. Currently just languages are used.
### Countries aren't respected yet. Currently, just languages are used.
## Developer Guide
### Database and Models
This extension uses two database tables:
- tx_sgmail_domain_model_template
Stores all template settings that have been provided via the backend module. The Default settings exist only in the register array and not in the database.
- tx_sgmail_domain_model_mail
-**tx_sgmail_domain_model_template**: Stores all template settings that have been provided via the backend module. The Default settings exist only in the register array and not in the database.
This table holds all the mails in the mailing queue. When they are sent, the flag **sent** is set to true and the **sending_time** is inserted. You can inspect the mailing queue with the backend module.
If an email should ignore the mail queue, it is still inserted in this table with the **sent** flag set to true.
-**tx_sgmail_domain_model_mail**:
This table holds all the mails in the mailing queue.
When they are sent, the flag **sent** is set to true, and the **sending_time** is inserted.
You can inspect the mailing queue with the backend module.
If an email should ignore the mail queue, it is still inserted in this table with the **sent** flag set to true.
The extbase model classes for these tables are located at the *Domain\Model* folder.
...
...
@@ -303,7 +301,7 @@ To change a fields identifier, select it in the form editor and enter your desir
sg_mail comes with two new finisher for your forms with the following settings regarding sg_mail integration:
-**Template key**: If this field is empty, a unique template name will be generated and automatically inserted into the field, after the form definition has been saved.
The generated template name is based on the form identifier, concatenated with the finisher identifier (separated by `-`).
The generated template name is based on the form identifier, concatenated with the finisher identifier (separated by `-`).
-**Automatic Registration**: A sg_mail registration will automatically be created. See the **Automatic Registration** section for more information
-**Ignore Mail Queue**: Mails will get send immediately and not added to the mail queue
...
...
@@ -313,16 +311,19 @@ If you select to automatically register your forms with sg_mail, the default htm
You can customize the TypoScript settings in the **setup.ts** in order to have control over automatically generated registration files:
# extension where automatic generated registrations are put. Will be appended with /Configuration/MailTemplates/. Make sure these folders exist!
configurationLocation = your_extension_key
```Typoscript
# extension where automatic generated registrations are put. Will be appended with /Configuration/MailTemplates/. Make sure these folders exist!
configurationLocation = your_extension_key
# default html template file, which serves as a fallback for all mail templates
This Service enables you to access your typoscript settings outside of your controller classes. You simply need to supply your page id and the extension key.
This Service enables you to access your typoscript settings outside your controller classes.
You simply need to supply your page id, and the extension key.
If you have no page id specific settings, set the page id to 0.