/Mail in groovy Secret
Last active
December 17, 2015 19:29
Mail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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