Typo3 8.7:表单完成器 EmailToReceiver / EmailToSender 的不同邮件模板
Typo3 8.7: Different mail templates for form finisher EmailToReceiver / EmailToSender
我将 Typo3 表单模块 (sysext) 与两个电子邮件处理程序一起使用:EmailToReceiver 与 EmailToSender。我设置了自定义邮件模板,但是
- 我如何 select 为这两封不同的邮件使用不同的邮件模板?
- 或者有其他方法可以发送两封不同的邮件吗?
您可以使用 templatePathAndFilename
整理器选项为您的邮件设置自定义模板。您可以为每个修整器单独设置:
finishers:
- identifier: EmailToReceiver
options:
# ...
templatePathAndFilename: EXT:my_site/Resources/Private/Templates/.../EmailToReceiver.html
- identifier: EmailToSender
options:
# ...
templatePathAndFilename: EXT:my_site/Resources/Private/Templates/.../EmailToSender.html
除了 Mathias Brodala 的正确答案外,您还可以在每个电子邮件终结器中使用 templateName
和 templateRootPaths
。如果配置如下,它将遵循您使用 options.format
设置的电子邮件格式:
finishers:
-
identifier: EmailToReceiver
options:
subject: 'E-Mail from website'
recipientAddress: your.company@example.com
recipientName: 'Your Company name'
senderAddress: '{email}'
senderName: '{lastname}'
replyToAddress: ''
carbonCopyAddress: ''
blindCarbonCopyAddress: ''
format: html
attachUploads: 'true'
templateName: '{@format}.html'
templateRootPaths:
20: 'EXT:your_extension/Resources/Private/Forms/Emails/Receiver/'
translation:
language: ''
-
identifier: EmailToSender
options:
subject: 'Your message'
recipientAddress: '{email}'
recipientName: '{lastname}'
senderAddress: your.company@example.com
senderName: 'Your Company name'
replyToAddress: ''
carbonCopyAddress: ''
blindCarbonCopyAddress: ''
format: html
attachUploads: 'true'
templateName: '{@format}.html'
templateRootPaths:
20: 'EXT:your_extension/Resources/Private/Forms/Emails/Sender/'
根据上面设置的文件路径,模板保存在
- your_extension/Resources/Private/Forms/Emails/Sender/
Html.html 或 Plaintext.html
- your_extension/Resources/Private/Forms/Emails/Receiver/
Html.html 或 Plaintext.html
可以找到完整的教程 here。
在 GitHub 上 a working TYPO3 extension 有几个示例表单,包括一个仅供发件人使用的带有自定义邮件模板的表单。
我将 Typo3 表单模块 (sysext) 与两个电子邮件处理程序一起使用:EmailToReceiver 与 EmailToSender。我设置了自定义邮件模板,但是
- 我如何 select 为这两封不同的邮件使用不同的邮件模板?
- 或者有其他方法可以发送两封不同的邮件吗?
您可以使用 templatePathAndFilename
整理器选项为您的邮件设置自定义模板。您可以为每个修整器单独设置:
finishers:
- identifier: EmailToReceiver
options:
# ...
templatePathAndFilename: EXT:my_site/Resources/Private/Templates/.../EmailToReceiver.html
- identifier: EmailToSender
options:
# ...
templatePathAndFilename: EXT:my_site/Resources/Private/Templates/.../EmailToSender.html
除了 Mathias Brodala 的正确答案外,您还可以在每个电子邮件终结器中使用 templateName
和 templateRootPaths
。如果配置如下,它将遵循您使用 options.format
设置的电子邮件格式:
finishers:
-
identifier: EmailToReceiver
options:
subject: 'E-Mail from website'
recipientAddress: your.company@example.com
recipientName: 'Your Company name'
senderAddress: '{email}'
senderName: '{lastname}'
replyToAddress: ''
carbonCopyAddress: ''
blindCarbonCopyAddress: ''
format: html
attachUploads: 'true'
templateName: '{@format}.html'
templateRootPaths:
20: 'EXT:your_extension/Resources/Private/Forms/Emails/Receiver/'
translation:
language: ''
-
identifier: EmailToSender
options:
subject: 'Your message'
recipientAddress: '{email}'
recipientName: '{lastname}'
senderAddress: your.company@example.com
senderName: 'Your Company name'
replyToAddress: ''
carbonCopyAddress: ''
blindCarbonCopyAddress: ''
format: html
attachUploads: 'true'
templateName: '{@format}.html'
templateRootPaths:
20: 'EXT:your_extension/Resources/Private/Forms/Emails/Sender/'
根据上面设置的文件路径,模板保存在
- your_extension/Resources/Private/Forms/Emails/Sender/
Html.html 或 Plaintext.html - your_extension/Resources/Private/Forms/Emails/Receiver/
Html.html 或 Plaintext.html
可以找到完整的教程 here。
在 GitHub 上 a working TYPO3 extension 有几个示例表单,包括一个仅供发件人使用的带有自定义邮件模板的表单。