cfmail
, but it has some smart functionality and a more CFWheels-like approach in general.config/settings.cfm
file and can look something like this:cfmail
does. That's quite a few./config/app.cfm
: here's an example configuration:/views/
folder, but we recommend a structured, logical approach. If different controllers utilize sendEmail()
and each require a unique template, place each email template within the views/controllername
folder structure.Membership
/views/membership/myemailtemplate.cfm
myemailtemplate.cfm
, which will contain HTML content.cfmail
tag as arguments. But it also accepts any variables that you need to pass to the email template itself.myemailtemplate
template and passing values for recipientName
and startDate
to it.template
argument should be the path to the view's folder name and template file name without the extension. If the template is in the current controller, then you don't need to specify a folder path to the template file. In that case, just be sure to store the template file in the folder with the rest of the views for that controller.template
argument to renderView().type
attribute of cfmail
? CFWheels is smart enough to figure out that you want to send as HTML since you have tags in the email body. (You can override this behavior if necessary though by passing in the type
argument.)templates
argument (notice the plural), and CFWheels will automatically figure out which one is text and which one is HTML.template
argument, the logic for which file to include follows the same logic as the template
argument to renderView().file
argument (or files
argument if you want multiple attachments). Simply pass in the name of a file that exists in the files
folder (or a subfolder of it) of your application.recipientName
and startDate
, in the example above) be placed as outputs in the template file.layout
argument.views/plainemaillayout.cfm
and views/htmlemaillayout.cfm
, we would call sendEmail() like so:templates
and layouts
arguments (again, notice the plurals), we provide a list of view files to use. CFWheels will figure out which of the templates and layouts are the HTML versions and separate out the MIME parts for you automatically.