sendEmail()

Description

Sends an email using a template and an optional layout to wrap it in.

Function Syntax

sendEmail([ templates, from, to, subject, layouts, detectMultipart ])

Parameters

Parameter Type Required Default Description
templates string No The path to the email template or two paths if you want to send a multipart email. if the detectMultipart argument is false the template for the text version should be the first one in the list (can also be called with the template argument).
from string Yes Email address to send from.
to string Yes Email address to send to.
subject string Yes The subject line of the email.
layouts any No false Layout(s) to wrap body in.
detectMultipart boolean No true When set to true Wheels will detect which of the templates is text and which one is html (by counting the < characters).

Examples

<!--- Get a member and send a welcome email passing in a few custom variables to the template --->
<cfset member = model("member").findByKey(newMember.id)>
<cfset sendEmail(to=member.email, template="myemailtemplate", subject="Thank You for Becoming a Member", recipientName=member.name, startDate=member.startDate)>