I'm using the Ozimov Spring Boot Email Tools found here
Very easy to use:
@Service
public class TestService {
@Autowired
private EmailService emailService;
public void sendEmail() throws UnsupportedEncodingException {
final Email email = DefaultEmail.builder()
.from(new InternetAddress("hari.seldon@the-foundation.gal",
"Hari Seldon"))
.to(newArrayList(
new InternetAddress("the-real-cleon@trantor.gov",
"Cleon I")))
.subject("You shall die! It's not me, it's Psychohistory")
.body("Hello Planet!")
.encoding("UTF-8").build();
emailService.send(email);
}
}
For now I just need to send basic, plain text email and I have that working. However, I really need to be able to specify custom mail class headers in my sent messages. I looked through the source but this library does not seem to have that capability. I'm hoping I'm wrong. Can this be done?