Class EmailPreview

java.lang.Object
io.meeds.portal.mail.util.EmailPreview

public final class EmailPreview extends Object
A sample of an email of the platform, with the saved branding, for the preview of the branding page. The two samples are the account emails that use the shared layout for real, with the labels of the same bundle and the same structure as the email a user receives, so that what the administrator sees is what is sent.
  • Field Details

  • Method Details

    • isTemplate

      public static boolean isTemplate(String template)
    • render

      public static String render(String template, EmailBrand brand, ResourceBundle bundle, String lang, String siteUrl)
      Parameters:
      template - one of TEMPLATES
      brand - the branding to show, the saved one
      bundle - the labels of the language of the preview
      lang - the language tag of the document
      siteUrl - the address of the site, which the sample link points to; anything that is not an http or https address is replaced by an example address
      Returns:
      the html of the sample email
      Throws:
      IllegalArgumentException - when the template is not known
    • render

      public static String render(String template, EmailBrand brand, ResourceBundle bundle, String lang, String siteUrl, EmailPreviewReader reader)
      Same as render(String, EmailBrand, ResourceBundle, String, String) with the person who reads the preview, so that the greeting is the one the administrator would get; a blank value is replaced by a sample one
      Parameters:
      reader - the reader of the preview, or null for sample names