Advertising sustains the DA. Ads are hidden for members. Join today

Webform Cookbook

How to send email attachments?

Last updated on
19 December 2018

What is an email attachment?

An email attachment is a computer file sent along with an email message.
-- https://en.wikipedia.org/wiki/Email_attachment

Sending email attachments

  • To send email attachments, please install and configure the SMTP Authentication Support module or the Mail System and SwiftMailer module
  • Make sure to check 'Include files as attachments' in your email handlers
  • Then add 'File upload' or 'Attachment' elements to your webform

Email handler with file attachments enabled

Sending file uploads as email attachments

  • Setup private files directory (PSA-2016-003
  • Add 'File upload' to your webform
  • Check 'Include files as attachments' in email handlers

Example of file upload element

Sending custom email attachments

  • Install the Webform Attachment sub-module
  • Use 'Attachment token' or 'Attachment Twig' to generate an attachment
  • Use 'Attachment URL' to send URL or path as an attachment
  • 'Attachment' elements support custom file names, link text, and forced downloads
  • 'Attachment' elements act like 'File upload' element
  • Check 'Include files as attachments' in email handlers

Example of an attachment element using tokens

Using the 'Attachment URL' element

  • URLs and file paths must be publically accessible
  • URLs and file paths are never shared with end-users

Help improve this page

Page status: No known problems

You can: