Skip to content

Instantly share code, notes, and snippets.

@technikamateur
Created October 28, 2018 11:36
Show Gist options
  • Save technikamateur/c4a27c9c9e27880dbb0300c90fe9a100 to your computer and use it in GitHub Desktop.
Save technikamateur/c4a27c9c9e27880dbb0300c90fe9a100 to your computer and use it in GitHub Desktop.
Java Mail 2
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