Powermail is one of the major Typo3 extension if you need to implement a form on your website. Thanks to all the flexible configuration options it provides capabilities not only for simple contact forms but also for advanced features such as validation, database interaction or dynamic user input processing.

If the direct settings in the content element are not enough, one can either use TypoScript for some advanced or configuration or use one of the many hooks provided to implement new custom features in a non-intrusive way.

TypoScript Configuration

To add an attachement to the mail send to the user that filled out the form is a request people often posted in chats and forums. In the past, this required to implement one of the hooks, but nowadays, this can be done via TypoScript.
Just upload the file (e.g., a PDF file) into your fileadmin area and add the following code to your template setup:

plugin.tx_powermail_pi1 {
  email {
    sender_mail {
      addAttachment = COA
      addAttachment {
        10 = TEXT
        10.value = fileadmin/myfile.pdf
        10.wrap = |
      }
    }
  }
}

Website with Multiple Forms

If you have multiple forms on your website and you want to attach different files or none, just use extension templates on the according pages.

Protect Attachement From direct Downloads

If you don’t want your content to be downloaded directly by a user just typing in http://mydomain.com/fileadmin/myfile.pdf, just add an htaccess protection for this directory. Note: This might also blog you from opening the file directly from the backend. So make sure the file is still available through a password authentication or similar.

Adding a Dynamically Generated Attachement

If one would like to have a dynamically generated attachement, e.g., a pdf with some of the user inputs generated into the document, this is a very custom request and still requires to extend one of the hooks provided by powermail. If you face such a request and need support with that, feel free to contact us.

Typo3: Powermail: Add Attachment to Sender Email with TypoScript

Post navigation


Leave a Reply