Package sk.iway.iwcm

Class SendMail

java.lang.Object
sk.iway.iwcm.SendMail

public class SendMail extends Object
Odosielanie emailu, priklad telnet spojenia: EHLO tau19.iway.sk MAIL FROM:noreply@interway.sk RCPT TO:veronika.husarova@employment.gov.sk DATA From:noreply@interway.sk To:veronika.husarova@employment.gov.sk Subject:test Test . QUIT
  • Field Details

  • Constructor Details

    • SendMail

      public SendMail()
  • Method Details

    • send

      public static boolean send(String fromName, String fromEmail, String toEmail, String subject, String text)
    • send

      public static boolean send(String fromName, String fromEmail, String toEmail, String subject, String text, javax.servlet.http.HttpServletRequest request)
    • send

      public static boolean send(String fromName, String fromEmail, String toEmail, String subject, String text, String attachments)
    • send

      public static boolean send(String fromName, String fromEmail, String toEmail, String ccEmail, String bccEmail, String subject, String text, String attachments)
    • send

      public static boolean send(String senderName, String senderEmail, String recipientEmail, String replyTo, String ccEmail, String bccEmail, String subject, String message, String baseHref, String attachmentsList)
    • sendCapturingException

      public static Pair<Boolean,Exception> sendCapturingException(String senderName, String senderEmail, String recipientEmail, String replyTo, String ccEmail, String bccEmail, String subject, String message, String baseHref, String attachmentsList)
    • sendCapturingException

      public static Pair<Boolean,Exception> sendCapturingException(String senderName, String senderEmail, String recipientEmail, String replyTo, String ccEmail, String bccEmail, String subject, String message, String baseHref, String attachmentsList, boolean sendLaterWhenException)
    • sendCapturingException

      public static Pair<Boolean,Exception> sendCapturingException(String senderName, String senderEmail, String recipientEmail, String replyTo, String ccEmail, String bccEmail, String subject, String message, String baseHref, String attachmentsList, boolean sendLaterWhenException, boolean writeToAuditLog)
      Odoslanie emailu
      Parameters:
      senderName - - meno odosielatela emailu
      senderEmail - - email odosielatela emailu
      recipientEmail - - email prijemcu
      replyTo - - email pre pole replyTo, alebo null
      subject - - predmet
      message - - body emailu, moze byt v HTML formate, vratane odkazov na obrazky a linky
      baseHref - - base HTTP adresa (aby bolo mozne nalinkovat obrazky a spravit relativne linky)
      attachmentsList - - zoznam priloh vo formate url_adresa1;nazov_suboru_do_emailu1;url_adresa2;nazov_suboru_do_emailu2;
      sendLaterWhenException - - ak je true, tak pri exception pri odosielani, ulozi e-mail pre neskorsie odoslanie
      writeToAuditLog - - ak je false, tak sa posle len e-mail, ale nezapise sa nic do auditlogu
      Returns:
      true, ak sa email podarilo odoslat, inak false
      Throws:
      Exception
    • sendCapturingException

      public static Pair<Boolean,Exception> sendCapturingException(MailHelper mailHelper)
    • sendLater

      public static boolean sendLater(String senderName, String senderEmail, String recipientEmail, String replyTo, String ccEmail, String bccEmail, String subject, String message, String baseHref, String date, String time)
    • sendLater

      public static boolean sendLater(String senderName, String senderEmail, String recipientEmail, String replyTo, String ccEmail, String bccEmail, String subject, String message, String baseHref, String date, String time, String attachments)
      Oneskorene odoslanie emailu
      Parameters:
      senderName -
      senderEmail -
      recipientEmail -
      replyTo -
      subject -
      message -
      baseHref -
      date -
      time -
      Returns:
    • getInlineAttachments

      public static List<String> getInlineAttachments(String htmlCode)
      Ziska zoznam inline priloh (obrazkov)
      Parameters:
      htmlCode -
      Returns:
    • isHtmlContent

      public static boolean isHtmlContent(String html)
      Otestuje, ci zadany test je HTML kod
      Parameters:
      html -
      Returns:
    • attFile

      public static void attFile(String serverPath, String fileName, javax.mail.Multipart mp)
      Description of the Method
      Parameters:
      serverPath - Description of the Parameter
      fileName - Description of the Parameter
      mp - Description of the Parameter
    • getEncoding

      public String getEncoding()
      Vrati kodovanie pre email podla nastavenia servera, alebo ak nie je prazdne podla konfiguracnej premennej emailEncoding
      Returns:
    • createAbsolutePath

      public static String createAbsolutePath(String htmlCode, String basePath)
      Vytvori absolutne cesty v zadanom HTML kode
      Parameters:
      htmlCode - - HTML kod
      basePath - - absolutna adresa, bez koncoveho /, napr. http://www.iway.sk
      Returns:
    • createAbsolutePath

      public static String createAbsolutePath(String htmlCode, javax.servlet.http.HttpServletRequest request)
    • getSession

      public static javax.mail.Session getSession(Properties props)
      Parameters:
      props -
      Returns:
    • getFirstEmailAddress

      public static String getFirstEmailAddress(String email)
      Ziska prvu email adresu zo stringu typu meno@domena.sk,ine@domena.sk (pre polia, ktore mozu mat len jeden email ako from a replyTo)
      Parameters:
      email -
      Returns:
    • getDefaultSenderName

      public static String getDefaultSenderName(String module, String fallbackName)
      Return senderName of various email from config value moduleDefaultSenderName or defaultSenderName if module version is not defined. If config value is not defined, fallback is empty then domain name will be used.
      Parameters:
      module -
      fallbackName - - if no defaultSenderName constants is defined this value will be used
      Returns:
    • getDefaultSenderEmail

      public static String getDefaultSenderEmail(String module, String fallbackEmail)
      Return senderEmail of various email from config value moduleDefaultSenderEmail or defaultSenderEmail if module version is not defined. If config value is not defined, fallback is empty then domain name will be used.
      Parameters:
      module -
      fallbackEmail - - if no defaultSenderEmail constants is defined this value will be used
      Returns: