1 package info.magnolia.cms.mail; 2 3 import info.magnolia.cms.core.Content; 4 import info.magnolia.cms.module.AbstractModule; 5 import info.magnolia.cms.module.InitializationException; 6 import info.magnolia.cms.module.InvalidConfigException; 7 8 import javax.jcr.RepositoryException; 9 10 import org.slf4j.Logger; 11 import org.slf4j.LoggerFactory; 12 13 14 17 public class Engine extends AbstractModule { 18 19 public static final String SERVER_MAIL_CONFIG = "smtp"; 20 21 public static final String MAIL_TEMPLATES_PATH = "templates"; 22 23 static final Logger log = LoggerFactory.getLogger(Engine.class); 24 25 28 public void init(Content configNode) throws InvalidConfigException, InitializationException { 29 try { 30 Content smtpNode = configNode.getContent(SERVER_MAIL_CONFIG); 31 Content templateNode = configNode.getContent(MAIL_TEMPLATES_PATH); 32 log.info("Loading mail server settings"); 33 MgnlMailFactory.getInstance().register(smtpNode); 34 log.info("Loading mail templates"); 35 MgnlMailFactory.getInstance().register(templateNode); 36 this.setInitialized(true); 37 } 38 catch (RepositoryException e) { 39 log.error("Missing configuration for mail. Module is not properly initialized"); 40 } 41 } 42 } 43 | Popular Tags |