Class SendEmailUtils

java.lang.Object
google.registry.ui.server.SendEmailUtils

public class SendEmailUtils extends Object
Utility class for sending emails from the app.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    SendEmailUtils(com.google.common.collect.ImmutableList<String> registrarChangesNotificationEmailAddresses, GmailClient gmailClient)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether there are any recipients set up.
    boolean
    sendEmail(String subject, String body)
    Sends an email from Nomulus to the registrarChangesNotificationEmailAddresses.
    boolean
    sendEmail(String subject, String body, com.google.common.collect.ImmutableList<String> additionalAddresses)
    Sends an email from Nomulus to the registrarChangesNotificationEmailAddresses and the specified additionalAddresses.
    boolean
    sendEmail(String subject, String body, Optional<String> bcc, com.google.common.collect.ImmutableList<String> additionalAddresses)
    Sends an email from Nomulus to the registrarChangesNotificationEmailAddresses, the bcc address, and the specified additionalAddresses.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • SendEmailUtils

      @Inject public SendEmailUtils(@Config("registrarChangesNotificationEmailAddresses") com.google.common.collect.ImmutableList<String> registrarChangesNotificationEmailAddresses, GmailClient gmailClient)
  • Method Details

    • sendEmail

      public boolean sendEmail(String subject, String body, Optional<String> bcc, com.google.common.collect.ImmutableList<String> additionalAddresses)
      Sends an email from Nomulus to the registrarChangesNotificationEmailAddresses, the bcc address, and the specified additionalAddresses. Returns true iff sending to at least 1 address was successful.

      This means that if there are no recipients (hasRecipients() returns false), this will return false even thought no error happened.

      This also means that if there are multiple recipients, it will return true even if some (but not all) of the recipients had an error.

    • sendEmail

      public boolean sendEmail(String subject, String body, com.google.common.collect.ImmutableList<String> additionalAddresses)
      Sends an email from Nomulus to the registrarChangesNotificationEmailAddresses and the specified additionalAddresses. Returns true iff sending to at least 1 address was successful.

      This means that if there are no recipients (hasRecipients() returns false), this will return false even thought no error happened.

      This also means that if there are multiple recipients, it will return true even if some (but not all) of the recipients had an error.

    • sendEmail

      public boolean sendEmail(String subject, String body)
      Sends an email from Nomulus to the registrarChangesNotificationEmailAddresses.

      See sendEmail(String, String, ImmutableList).

    • hasRecipients

      public boolean hasRecipients()
      Returns whether there are any recipients set up. sendEmail(java.lang.String, java.lang.String, java.util.Optional<java.lang.String>, com.google.common.collect.ImmutableList<java.lang.String>) will always return false if there are no recipients.