Attaching a "standard" file to the e-mail
In the preceding recipe, we saw how to attach a file uploaded by the user, here we'll look at the similar task of attaching a file to an e-mail sent to the user. This time the file is not uploaded but is in a folder on the server somewhere.
Very often these are "terms and conditions" that you want to send out but we'll stay with the Newsletter theme and assume that we have a sample newsletter in a PDF file.
Getting ready
We'll be using the same form but this time, please make sure that the User Email Setup is enabled. You can also disable the administrator Email Setup if you like; we won't need it for this recipe.
Note
You can enable or disable an Email Setup in the Email Properties box for the setup. Set the Enabled drop-down to YES or NO and click Apply.
You'll also need a file to attach. We'll use a file called newsletter.pdf
that's been uploaded to the site with the site Media Manager into the root/images
folder (that's the default folder for the...