Typo3 8.7:表单装订器EmailToReceiver / EmailToSender的不同邮件模板

时间:2018-03-09 12:45:00

标签: forms typo3 email-templates typo3-8.x

我正在使用Typo3表单模块(sysext)和两个电子邮件终结者:EmailToReceiver与EmailToSender。我设置了一个自定义的mailtemplate,但是

  • 我如何为这两封不同的邮件选择不同的邮件模板?
  • 还有另外一种方法可以发送两封不同的邮件吗?

2 个答案:

答案 0 :(得分:3)

您可以使用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

答案 1 :(得分:2)

除了Mathias Brodala的正确答案之外,您还可以在每个电子邮件装订器中使用templateNametemplateRootPaths。如果配置如下,它将尊重您使用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 /资源/专用/表格/电子邮件/发件人/
    Html.html Plaintext.html
  • your_extension /资源/专用/表格/电子邮件/接收器/
    Html.html Plaintext.html

可以找到完整的教程here

在GitHub上a working TYPO3 extension有几个示例表单,包括仅为发件人提供自定义邮件模板的表单。