Skip to content

Instantly share code, notes, and snippets.

@uttamhn
Last active Dec 17, 2015
Embed
What would you like to do?
Mail
class Mail {
static transactional = false
def grailsApplication
def ctx = ApplicationHolder.application.mainContext.servletContext
def contextPath = ctx.getRealPath(Constants.PATH)
def sendEmail={company,viewName,subjectText,card->
def cardDetails=company.getCreditCard()
def ApplicationURL = grailsApplication.config.environment.application.url
def currentDate = new Date().format("MMM dd, yyyy")
sendMail {
multipart true
to company.email
subject subjectText
inline 'springsourceInlineImage', new File(contextPath)
body(
view:viewName,
model:[name:company.title+' '+company.location,
email:company.email,
displayDate:currentDate,
orderValue:"\$"+new DecimalFormat("#.00").format(credit),
applicationUrl:ApplicationUrl]
)
}
isMailSent = true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment