Skip to content

Instantly share code, notes, and snippets.

@uttamhn
Last active December 17, 2015 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uttamhn/8647a7d180084eac9f0e to your computer and use it in GitHub Desktop.
Save uttamhn/8647a7d180084eac9f0e to your computer and use it in GitHub Desktop.
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