Interfaces and classes used for sending mails with Spring
The package org.springframework.mail
is used for mail configuration in the spring application.
The following are the three main interfaces that are used for sending mail:
MailSender
: This interface is used to send simple mail messages.JavaMailSender
: This interface is a subinterface of theMailSender
interface and supports sending mail messages.MimeMessagePreparator
: This interface is a callback interface that supports theJavaMailSender
interface in the preparation of mail messages.
The following classes are used for sending mails using Spring:
SimpleMailMessage
: This is a class which has properties such asto
,from
,cc
,bcc
,sentDate
, and many others. TheSimpleMailMessage
interface sends mail withMailSenderImp
classes.JavaMailSenderImpl
: This class is an implementation class of theJavaMailSender
interface.MimeMessageHelper
: This class helps with preparing MIME messages.