Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Configuration
- @PropertySource("file:///${CONFIG_LOCATION}/smtp_config.properties")
- @ConfigurationProperties(prefix = "mail")
- public class SmtpProducerBase {
- private String host;
- private String port;
- private String password;
- private String mail;
- private boolean smtpStarttls;
- private boolean smtpAuth;
- public String getHost() {
- return host;
- }
- public void setHost(String host) {
- this.host = host;
- }
- public String getPort() {
- return port;
- }
- public void setPort(String port) {
- this.port = port;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- public String getMail() {
- return mail;
- }
- public void setMail(String mail) {
- this.mail = mail;
- }
- public boolean isSmtpStarttls() {
- return smtpStarttls;
- }
- public void setSmtpStarttls(boolean smtpStarttls) {
- this.smtpStarttls = smtpStarttls;
- }
- public boolean isSmtpAuth() {
- return smtpAuth;
- }
- public void setSmtpAuth(boolean smtpAuth) {
- this.smtpAuth = smtpAuth;
- }
- }
- @Component
- public class SMTPProducerRouteBase extends ConfigurationRoute {
- @Autowired
- private SmtpProducerBase smtpProducerBase;
- public void configure() throws Exception {
- super.configure();
- from("direct:sendMail").id("send_mail_route")
- .log("Enviando mensaje...")
- .to("smtp://sendMail?"
- + "host="+smtpProducerBase.getHost()
- + "&port="+smtpProducerBase.getPort()
- + "&contentType=text/html"
- + "&password="+smtpProducerBase.getPassword()
- + "&username="+smtpProducerBase.getMail()
- + "&mail.smtp.starttls.enable="+smtpProducerBase.isSmtpStarttls()
- + "&mail.smtp.auth="+smtpProducerBase.isSmtpAuth())
- .log("Proceso de envío finalizado.")
- .end();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement