Class EmailService

java.lang.Object
com.jk.webstack.services.email.EmailService

public class EmailService extends Object
This class represents a service used for managing email operations, including queuing and sending emails.
Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Constructor Details

    • EmailService

      public EmailService()
  • Method Details

    • addEmailToQueue

      public void addEmailToQueue(String to, String subject, String emailContents, boolean callSend)
      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 the sendEmailsInQueue method.
    • sendEmailsInQueue

      public void sendEmailsInQueue()
      This method sends emails in the queue.
    • getEmailsInQueue

      public List<Email> getEmailsInQueue()
      This method retrieves emails currently in the queue.
      Returns:
      the list of emails in the queue.
    • getEmailSender

      protected JKMailSender getEmailSender()
      This method retrieves the configured email sender.

      If none is provided, a default sender is used.

      Returns:
      the email sender.
    • setSender

      public void setSender(JKMailSender sender)
      This method sets the email sender to the provided one.
      Parameters:
      sender - Specifies the new email sender.
    • main

      public static void main(String[] args)
      This main method demonstrate how to use the email services.
      Parameters:
      args - the command-line arguments.