diff --git a/Readme.md b/Readme.md index 0e398f1..43de72d 100644 --- a/Readme.md +++ b/Readme.md @@ -20,7 +20,7 @@ It is a marketplace where customer can place order and Admin can manage inventor - Maven ## Configuration -Change the SMTP details in "EmailConfig" +Change the SMTP details in "application.properties" ## Login Details diff --git a/src/main/java/me/anant/PMS/config/EmailConfig.java b/src/main/java/me/anant/PMS/config/EmailConfig.java deleted file mode 100644 index 4df224e..0000000 --- a/src/main/java/me/anant/PMS/config/EmailConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -package me.anant.PMS.config; - -import java.util.Properties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.mail.javamail.JavaMailSender; -import org.springframework.mail.javamail.JavaMailSenderImpl; - -@Configuration -public class EmailConfig { - @Bean - public JavaMailSender getJavaMailSender() - { - JavaMailSenderImpl mailSender = new JavaMailSenderImpl(); - mailSender.setHost("smtp.mailtrap.io"); - mailSender.setPort(2525); - - mailSender.setUsername("53b095fe63e8b6"); - mailSender.setPassword("c87dc71a300727"); - - Properties props = mailSender.getJavaMailProperties(); - props.put("mail.transport.protocol", "smtp"); - props.put("mail.smtp.auth", "true"); - props.put("mail.smtp.starttls.enable", "true"); - props.put("mail.debug", "true"); - - return mailSender; - } -} diff --git a/src/main/java/me/anant/PMS/service/EmailService.java b/src/main/java/me/anant/PMS/service/EmailService.java index c2399cc..334c216 100644 --- a/src/main/java/me/anant/PMS/service/EmailService.java +++ b/src/main/java/me/anant/PMS/service/EmailService.java @@ -8,40 +8,32 @@ import org.springframework.mail.javamail.MimeMessagePreparator; import org.springframework.stereotype.Service; -import me.anant.PMS.config.EmailConfig; - @Service public class EmailService { + @Autowired - EmailConfig emailConfig; - + private JavaMailSender javaMailSender; + public void send(String to, String subject, String body) { - String template = "\r\n" + - "\r\n" + - "
\r\n" + - "" - + "" - + "" - + "" - + body - + "