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, String body){
/*Code */
}
public void sendmail(String from, String []to, String subject, String body){
/*Code */
}
public void sendmime_mail(final String from, final String to, final String subject, final String body)...