
com.causecode.util.GenericEmailService.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nucleus Show documentation
Show all versions of nucleus Show documentation
nucleus is a Grails-Groovy plugin which contains utility methods, classes and endpoints.
/*
* Copyright (c) 2016, CauseCode Technologies Pvt Ltd, India.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are not permitted.
*/
package com.causecode.util
import grails.plugin.asyncmail.AsynchronousMailService
import org.springframework.mail.MailException
/**
* This class is used for sending emails using the AsynchronousMailPlugin. It is a utility class that handles exception
* while sending emails.
*
* @author Nikhil Sharma
* @since 2.0.0
*/
class GenericEmailService {
AsynchronousMailService asynchronousMailService
boolean sendEmail(Closure closure, String eventName) {
try {
asynchronousMailService.sendMail(closure)
} catch (MailException e) {
log.warn "Error sending email for $eventName", e
return false
}
return true
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy