All Downloads are FREE. Search and download functionalities are using the official Maven repository.

email.dispatcher.EmailDispatcherImpl Maven / Gradle / Ivy

The newest version!
package email.dispatcher;

import javax.ejb.Stateless;
import javax.inject.Inject;

import com.outjected.email.api.MailMessage;

import email.configuration.mailer.Mailer;

@Stateless
public class EmailDispatcherImpl implements EmailDispatcher{
	private static final long serialVersionUID = -73733075856472012L;

	@Inject
	private Mailer mailer;	

	@Override
	public void send(Message message){
		
		if(message == null)
			throw new IllegalArgumentException("The message can not be null.");
					
		MailMessage mailMessage = this.mailer.newMessage();
		
		mailMessage.to(message.getSender())
			.subject(message.getSubject())
			.bodyHtml(message.getHtmlContent())
			.send();
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy