Sending MIME messages

Multipurpose Internet Mail Extension (MIME) allows attachments to be sent over the Internet. This class just demonstrates how we can send mail with MIME messages. Using a MIME message sender type class is not advisable if you are not sending any attachments with the mail message. In the next section, we will look at the details of how we can send mail with attachments.

Update the MailSenderService class with another method. We have used the MIME message preparator and have overridden the prepare method() to set properties for the mail.

public class MailSenderService { @Autowired private MailSender mailSender; @AutoWired private SimpleMailMessage simplemailmessage; public void sendmail(String from, String to, String subject, ...

Get Mastering Spring Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.