Introduction
cbMailServices is a module to send email in a fluent and abstracted approach.
Last updated
Was this helpful?
Was this helpful?
newMail(
to : "email@email.com",
from : "no_reply@ortussolutions.com",
subject : "Mail Services Rock",
type : "html", // Can be plain, html, or text
bodyTokens : {
user : "Luis",
product : "ColdBox",
link : event.buildLink( 'home' )
}
)
.setBody("
<p>Dear @user@,</p>
<p>Thank you for downloading @product@, have a great day!</p>
<p><a href='@link@'>@link@</a></p>
")
.addAttachment( expandPath( "/tmp/reports/report.pdf" ) )
.setReadReceipt( "myemail@email.com" )
.send()
.onSuccess( ( result, mail ) => {
// Process the success
})
.onError( ( result, mail ) => {
// Process the error
})<major>.<minor>.<patch>