Guest User

Untitled

a guest
Dec 12th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. package com.mail.demo;
  2.  
  3. import com.mail.demo.service.MailService;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.boot.CommandLineRunner;
  6. import org.springframework.boot.SpringApplication;
  7. import org.springframework.boot.autoconfigure.SpringBootApplication;
  8.  
  9. @SpringBootApplication
  10. public class DemoApplication implements CommandLineRunner {
  11.  
  12. @Autowired
  13. MailService mailService;
  14.  
  15. public static void main(String[] args) {
  16. SpringApplication.run(DemoApplication.class, args);
  17. }
  18.  
  19. @Override
  20. public void run(String... args) throws Exception {
  21. try {
  22. mailService.sendMail("poolsaliya@gmail.com", "poolsaliya@gmail.com", "Mail from SpringBoot", "hello");
  23. System.out.println("done");
  24. }
  25. catch (Exception e) {
  26. System.out.println(e.getMessage());
  27. }
  28. }
  29.  
  30. }
Add Comment
Please, Sign In to add comment