source: src/main/java/it/finki/charitable/services/EmailService.java@ 194776a

Last change on this file since 194776a was 3fc9e50, checked in by KostaFortumanov <kfortumanov@…>, 3 years ago

prototip part1

  • Property mode set to 100644
File size: 814 bytes
Line 
1package it.finki.charitable.services;
2
3import org.springframework.mail.SimpleMailMessage;
4import org.springframework.mail.javamail.JavaMailSender;
5import org.springframework.stereotype.Component;
6
7@Component
8public class EmailService {
9
10 private final JavaMailSender javaMailSender;
11
12 public EmailService(JavaMailSender javaMailSender) {
13 this.javaMailSender = javaMailSender;
14 }
15
16 public void sendValidationEmail(String to, String subject, String token) {
17 SimpleMailMessage message = new SimpleMailMessage();
18 message.setTo(to);
19 message.setSubject(subject);
20
21 String text = "Verify your account on the following link\n" +
22 "http://localhost:8080/validate?token=" + token;
23 message.setText(text);
24 javaMailSender.send(message);
25 }
26}
Note: See TracBrowser for help on using the repository browser.