Created
October 28, 2018 11:36
-
-
Save technikamateur/c4a27c9c9e27880dbb0300c90fe9a100 to your computer and use it in GitHub Desktop.
Java Mail 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package videoshop.customer; | |
import org.springframework.mail.SimpleMailMessage; | |
import org.springframework.mail.javamail.JavaMailSender; | |
import org.springframework.stereotype.Component; | |
@Component | |
public class CustomerNewMail { | |
private final JavaMailSender emailSender; | |
private SimpleMailMessage message; | |
CustomerNewMail (JavaMailSender emailSender) { | |
this.emailSender = emailSender; | |
message = new SimpleMailMessage(); | |
} | |
public void sendMessage() { | |
emailSender.send(message); | |
} | |
public void setTo(String to) { | |
message.setTo(to); | |
} | |
public void setSubject(String subject) { | |
message.setSubject(subject); | |
} | |
public void setText(String text) { | |
message.setText(text); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment