1 package info.magnolia.cms.mail.handlers; 2 3 import info.magnolia.cms.mail.templates.MgnlEmail; 4 5 import java.util.Arrays ; 6 7 import javax.mail.Transport ; 8 9 import org.slf4j.Logger; 10 import org.slf4j.LoggerFactory; 11 12 13 19 public class SimpleMailHandler implements MgnlMailHandler { 20 21 24 private static Logger log = LoggerFactory.getLogger(SimpleMailHandler.class); 25 26 public synchronized void prepareAndSendMail(MgnlEmail email) throws Exception { 27 email.setBody(); 28 sendMail(email); 29 } 30 31 public synchronized void sendMail(MgnlEmail email) throws Exception { 32 Transport.send(email); 33 log.info("Mail has been sent to: {}", Arrays.asList(email.getAllRecipients())); 34 } 35 } 36 | Popular Tags |