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

io.soffa.foundation.support.email.Mailer Maven / Gradle / Ivy

There is a newer version: 2.0.2
Show newest version
package io.soffa.foundation.support.email;

import io.soffa.foundation.support.email.model.Email;
import io.soffa.foundation.support.email.model.EmailAck;

import java.util.Map;

public class Mailer implements EmailSender {

    private final Map clients;
    private EmailSender defaultSender;
    public static final String DEFAULT = "default";

    public Mailer(Map clients) {
        this.clients = clients;
        if (clients != null && !clients.isEmpty()) {
            defaultSender = clients.get(DEFAULT);
            if (defaultSender == null) {
                defaultSender = clients.values().iterator().next();
            }
        }
    }

    public EmailSender getClient(String id) {
        return clients.get(id);
    }

    @Override
    public EmailAck send(Email message) {
        return defaultSender.send(message);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy