![JAR search and dependency download from the Maven repository](/logo.png)
br.com.jhonsapp.email.session.configurator.SenderConfigurator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of email-dispatcher Show documentation
Show all versions of email-dispatcher Show documentation
Email Dispatcher is an open source project created by Jhonys Camacho and Jhonathan Camacho to facilitate the sending of emails.
package br.com.jhonsapp.email.session.configurator;
import java.io.Serializable;
import java.util.Properties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.outjected.email.impl.SimpleMailConfig;
import br.com.jhonsapp.email.session.properties.UserProperties;
import br.com.jhonsapp.util.loader.PropertiesLoader;
/**
* This class is used to configure and load email sender information.
*
* @author Jhonathan Camacho
*
*/
@Component
public class SenderConfigurator implements Serializable {
/**
* Generated serial version id created at 08 July 2017.
*/
private static final long serialVersionUID = -8198436696559752388L;
@Autowired
private PropertiesLoader loader;
private SimpleMailConfig sessionConfig;
private Properties userProperties;
public void configure(SimpleMailConfig sessionConfig) {
this.sessionConfig = sessionConfig;
userProperties = loader.getPropertiesFile(UserProperties.USER_PROPERTIES);
verifyIfAllUserInformationValuesExist();
setSenderInformationInSimpleMailConfig();
}
private void verifyIfAllUserInformationValuesExist() {
loader.verifyIfValueExists(userProperties, UserProperties.typeKey);
loader.verifyIfValueExists(userProperties, UserProperties.usernameKey);
loader.verifyIfValueExists(userProperties, UserProperties.passwordKey);
}
private void setSenderInformationInSimpleMailConfig() {
sessionConfig.setUsername(loader.getProperty(userProperties, UserProperties.usernameKey));
sessionConfig.setPassword(loader.getProperty(userProperties, UserProperties.passwordKey));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy