【问题标题】:Typo3 8.7: Different mail templates for form finisher EmailToReceiver / EmailToSenderTypo3 8.7:表单整理器 EmailToReceiver / EmailToSender 的不同邮件模板
【发布时间】:2018-08-18 01:06:04
【问题描述】:

我将 Typo3 表单模块 (sysext) 与两个电子邮件整理程序一起使用:EmailToReceiver 与 EmailToSender。我设置了一个自定义邮件模板,但是

  • 如何为这两个不同的邮件选择不同的邮件模板?
  • 或者还有其他方法可以发送两封不同的邮件吗?

【问题讨论】:

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


    【解决方案1】:

    除了 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/Resources/Private/Forms/Emails/Sender/
      Html.htmlPlaintext.html
    • your_extension/Resources/Private/Forms/Emails/Receiver/
      Html.htmlPlaintext.html

    完整教程可以在here找到。

    在 GitHub 上是 a working TYPO3 extension,其中包含几个示例表单,包括一个带有仅为发件人自定义邮件模板的表单。

    【讨论】:

    • 说的很详细也很有帮助
    【解决方案2】:

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

    【讨论】:

    • 是的,我编辑了这个值。所以我为 EmailToReceiver 和 EmailToSender 设置了一个模板。这两种情况我需要不同的模板。
    • 您可以在每个电子邮件完成程序中设置templatePathAndFilename。这允许您设置不同的路径并使用不同的邮件模板。
    • @mathias-brodala:但是这样你就无法区分 HTML 和 PLAINTEXT 格式了,对吧?
    • 您已经在整理器配置中选择了带有options.format 的邮件格式。除此之外,您还可以设置templateRootPaths,如下所示:sklein-medien.de/en/tutorials/detail/… - 然后templateName: '{@format}.html' 将尊重格式选项。
    • 这工作正常,谢谢。另外:要更改每个表单,可以在 fileadmin/user_upload/ 中编辑文件 {formname}.yaml(使用 BE-form-editor 制作的 conf 文件的默认路径)。
    猜你喜欢
    • 1970-01-01
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多