Last change
on this file was d3cf3a1, checked in by Marija Micevska <marija_micevska@…>, 2 years ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
863 bytes
|
Line | |
---|
1 | package project.educatum.service.impl;
|
---|
2 |
|
---|
3 | import org.springframework.beans.factory.annotation.Autowired;
|
---|
4 | import org.springframework.mail.SimpleMailMessage;
|
---|
5 | import org.springframework.mail.javamail.JavaMailSender;
|
---|
6 | import org.springframework.stereotype.Service;
|
---|
7 | import project.educatum.service.EmailService;
|
---|
8 |
|
---|
9 | @Service
|
---|
10 | public class EmailServiceImpl implements EmailService {
|
---|
11 |
|
---|
12 | private final JavaMailSender emailSender;
|
---|
13 |
|
---|
14 | public EmailServiceImpl(JavaMailSender emailSender) {
|
---|
15 | this.emailSender = emailSender;
|
---|
16 | }
|
---|
17 |
|
---|
18 | @Override
|
---|
19 | public void sendMessage(String to, String subject, String text) {
|
---|
20 | SimpleMailMessage message = new SimpleMailMessage();
|
---|
21 | message.setFrom("activation@educatum.com");
|
---|
22 | message.setTo(to);
|
---|
23 | message.setSubject(subject);
|
---|
24 | message.setText(text);
|
---|
25 | this.emailSender.send(message);
|
---|
26 | }
|
---|
27 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.