protected void activate()

in alerting/alerter/email/src/main/java/org/apache/karaf/decanter/alerting/email/EmailAlerter.java [62:87]


    protected void activate(Dictionary<String, Object> config) throws ConfigurationException {
        from = (config.get("from") != null) ? config.get("from").toString() : null;
        to = (config.get("to") != null) ? config.get("to").toString() : null;
        subjectTemplate = (config.get("subject.template") != null) ? config.get("subject.template").toString() : null;
        bodyTemplate = (config.get("body.template") != null) ? config.get("body.template").toString() : null;
        bodyType = (config.get("body.type") != null) ? config.get("body.type").toString() : "text/plain";
        cc = (config.get("cc") != null) ? config.get("cc").toString() : null;
        bcc = (config.get("bcc")  != null) ? config.get("bcc").toString() : null;

        properties = new Properties();
        properties.put("mail.smtp.host", config.get("host"));
        properties.put("mail.smtp.port", config.get("port"));
        properties.put("mail.smtp.auth", config.get("auth"));
        properties.put("mail.smtp.starttls.enable", config.get("starttls"));
        properties.put("mail.smtp.ssl.enable", config.get("ssl"));
        String username = (String) config.get("username");
        String password = (String) config.get("password");
        if (username != null) {
            properties.put("mail.smtp.user", username);
        }
        if (password != null) {
            properties.put("mail.smtp.password", password);
        }

        formatter = new EmailFormatter();
    }