![JAR search and dependency download from the Maven repository](/logo.png)
br.com.jhonsapp.email.dispatcher.EmailDispatcherImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of email-dispatcher Show documentation
Show all versions of email-dispatcher Show documentation
Email Dispatcher is an open source project created by Jhonys Camacho and Jhonathan Camacho to facilitate the sending of emails.
package br.com.jhonsapp.email.dispatcher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.outjected.email.api.MailMessage;
import com.outjected.email.api.SendFailedException;
/**
* Class responsible for dispatcher the emails.
*
* @author Jhonathan Camacho
*
*/
@Service
public class EmailDispatcherImpl implements EmailDispatcher {
/**
* Generated serial version id created at 08 July 2017.
*/
private static final long serialVersionUID = -4126868513984414914L;
private MailMessage mailMessage;
@Autowired
public EmailDispatcherImpl(MailMessage mailMessage) {
this.mailMessage = mailMessage;
}
@Override
public boolean send(Message message) {
if (message == null)
throw new IllegalArgumentException("The message can not be null.");
try {
mailMessage.to(message.getSender())
.subject(message.getSubject())
.bodyHtml(message.getHtmlContent())
.send();
return true;
} catch (SendFailedException e) {
return false;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy