Send emails with Spring by using Java annotations – Stack Overflow

Send emails with Spring by using Java annotations – Stack Overflow

@Configuration public class MailConfig { @Value”${email.host}” private String host; @Value”${email.port}” private Integer port; @Bean public JavaMailSender javaMailService { JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl; javaMailSender.setHosthost; javaMailSender.setPortport; javaMailSender.setJavaMailPropertiesgetMailProperties; return javaMailSender; } private Properties getMailProperties { Properties properties = new Properties; properties.setProperty”mail.transport.protocol”, “smtp”; properties.setProperty”mail.smtp.auth”, “false”; properties.setProperty”mail.smtp.starttls.enable”, “false”; properties.setProperty”mail.debug”, “false”; return properties; } }

via Send emails with Spring by using Java annotations – Stack Overflow.

Leave a comment