Class SendEmail

java.lang.Object
de.businesscode.util.SendEmail

public class SendEmail extends Object
Set these jndi properties. de.businesscode.bcdui.localjndi.smtp.host = mysmtphost de.businesscode.bcdui.localjndi.smtp.password = mysmtppassword de.businesscode.bcdui.localjndi.smtp.sender = NOREPLY@myemail.com de.businesscode.bcdui.localjndi.smtp.user = mysmtpuser de.businesscode.bcdui.localjndi.smtp.port = 25 de.businesscode.bcdui.localjndi.smtp.starttls = true|false de.businesscode.bcdui.localjndi.smtp.subject = Scheduled Report de.businesscode.bcdui.localjndi.smtp.body = Please find your report attached.
  • Field Details

    • JNDI_SMTP_HOST

      public static String JNDI_SMTP_HOST
    • JNDI_SMTP_PORT

      public static String JNDI_SMTP_PORT
    • JNDI_SMTP_STARTTLS

      public static String JNDI_SMTP_STARTTLS
    • JNDI_SMTP_USER

      public static String JNDI_SMTP_USER
    • JNDI_SMTP_PASSWORD

      public static String JNDI_SMTP_PASSWORD
    • JNDI_SMTP_SENDER

      public static String JNDI_SMTP_SENDER
    • JNDI_SMTP_BODY

      public static String JNDI_SMTP_BODY
    • JNDI_SMTP_SUBJECT

      public static String JNDI_SMTP_SUBJECT
    • session

      protected jakarta.mail.Session session
    • host

      protected String host
    • port

      protected int port
    • starttls

      protected boolean starttls
    • user

      protected String user
    • password

      protected String password
    • subject

      protected String subject
    • body

      protected String body
    • fromInternetAddress

      protected jakarta.mail.internet.InternetAddress fromInternetAddress
    • nextMessage

      protected jakarta.mail.internet.MimeMessage nextMessage
  • Constructor Details

  • Method Details

    • setSender

      public void setSender(String sender) throws jakarta.mail.internet.AddressException
      Throws:
      jakarta.mail.internet.AddressException
    • initSession

      protected void initSession() throws GeneralSecurityException
      Create a Session object to represent a mail session with the specified properties. Sessions do not need to be closed
      Parameters:
      port -
      Throws:
      GeneralSecurityException
    • send

      public void send(String receipients, String subject, String body, boolean html) throws jakarta.mail.MessagingException
      Actually send an email to multiple receipients
      Parameters:
      receipients - semicolon separated
      subject -
      body -
      attachments - may be null
      Throws:
      jakarta.mail.MessagingException
    • send

      public void send(String receipients, String subject, String body, String attachmentName, File attachment, boolean html) throws jakarta.mail.MessagingException
      Actually send an email to multiple receipients
      Parameters:
      receipients - semicolon separated
      subject -
      body -
      attachments - may be null
      Throws:
      jakarta.mail.MessagingException
    • sendWithFilenames

      public void sendWithFilenames(String receipients, String subject, String body, Map<String,String> attachmentFilenames, boolean html) throws jakarta.mail.MessagingException
      Actually send an email to multiple receipients
      Parameters:
      receipients -
      subject -
      body -
      attachments - attachmentname - filename
      Throws:
      jakarta.mail.MessagingException
    • sendWithFiles

      public void sendWithFiles(String receipients, String subject, String body, Map<String,File> attachmentFiles, boolean html) throws jakarta.mail.MessagingException
      Actually send an email to multiple receipients
      Parameters:
      receipients - semicolon separated
      subject -
      body -
      attachments - attachmentname - file
      Throws:
      jakarta.mail.MessagingException
    • send

      public void send(String receipients, String subject, String body, Map<String,jakarta.activation.DataSource> attachments, boolean html) throws jakarta.mail.MessagingException
      Actually send an email to multiple receipients
      Parameters:
      receipients - semicolon separated
      subject -
      body -
      attachments -
      Throws:
      jakarta.mail.MessagingException
    • sendCC

      public void sendCC(String receipients, String receipientsCc, String receipientsBcc, String subject, String body, Map<String,jakarta.activation.DataSource> attachments, boolean html) throws jakarta.mail.MessagingException
      Actually send an email to multiple receipients
      Parameters:
      receipients - semicolon separated
      cc - receipients semicolon separated
      subject -
      body -
      attachments -
      Throws:
      jakarta.mail.MessagingException