Package com.jk.webstack.services.email
Class EmailService
java.lang.Object
com.jk.webstack.services.email.EmailService
This class represents a service used for managing email operations, including
queuing and sending emails.
- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEmailToQueue
(String to, String subject, String emailContents, boolean callSend) This method adds an email to the queue for sending.protected JKMailSender
This method retrieves the configured email sender.This method retrieves emails currently in the queue.static void
This main method demonstrate how to use the email services.void
This method sends emails in the queue.void
setSender
(JKMailSender sender) This method sets the email sender to the provided one.
-
Constructor Details
-
EmailService
public EmailService()
-
-
Method Details
-
addEmailToQueue
This method adds an email to the queue for sending.- Parameters:
to
- Specifies the recipient's email address.subject
- Specifies the subject of the email.emailContents
- Specifies the contents of the email.callSend
- Indicates whether to immediately call thesendEmailsInQueue
method.
-
sendEmailsInQueue
public void sendEmailsInQueue()This method sends emails in the queue. -
getEmailsInQueue
This method retrieves emails currently in the queue.- Returns:
- the list of emails in the queue.
-
getEmailSender
This method retrieves the configured email sender.If none is provided, a default sender is used.
- Returns:
- the email sender.
-
setSender
This method sets the email sender to the provided one.- Parameters:
sender
- Specifies the new email sender.
-
main
This main method demonstrate how to use the email services.- Parameters:
args
- the command-line arguments.
-