Class MovingMessage

java.lang.Object
com.icegreen.greenmail.mail.MovingMessage

public class MovingMessage extends Object
Contains information for delivering a mime email.
  • Constructor Details

    • MovingMessage

      public MovingMessage()
  • Method Details

    • getAuthenticationState

      public AuthenticationState getAuthenticationState()
      Retrieves the state object with the data used for authentication. Currently PLAIN and LOGIN authentication is supported. You can use this, for example, to retrieve the username or password that was sent by the client.

      Note that this will return null when no authentication was performed or needed.

      Returns:
      The state used by the AUTH command, if any.
    • setAuthenticationState

      public void setAuthenticationState(AuthenticationState authenticationState)
      Retrieves the state object with the data used for authentication. Currently PLAIN and LOGIN authentication is supported. You can use this, for example, to retrieve the username or password that was sent by the client.

      Note that this will return null when no authentication was performed or needed.

    • getToAddresses

      public List<MailAddress> getToAddresses()
      Retrieves the addresses from which the email was sent. Note that these are the RCPT TO addresses from the SMTP envelope, not the TO addresses from the mail header.
      Returns:
      The address to which the mail is directed.
    • getMessage

      public jakarta.mail.internet.MimeMessage getMessage()
      Retrieves the contents of the mail message, including all mail headers and the body.
      Returns:
      The message that was sent.
    • getReturnPath

      public MailAddress getReturnPath()
      Retrieves the address from which the email was sent. Note that this is the MAIL FROM address from the SMTP envelope, not the FROM address(es) from the mail header.
      Returns:
      The address from which the email was sent.
    • setReturnPath

      public void setReturnPath(MailAddress fromAddress)
      Sets or overwrites the address from which the email was sent. Note that this is the MAIL FROM address from the SMTP envelope, not the FROM address(es) from the mail header.
      Parameters:
      fromAddress - The address from which the email was sent.
    • addRecipient

      public void addRecipient(MailAddress s)
      Adds an address from which the email was sent. Note that these are the RCPT TO addresses from the SMTP envelope, not the TO addresses from the mail header.
    • removeRecipient

      public void removeRecipient(MailAddress s)
      Removes an address from the list of addresses from which the email was sent. Note that these are the RCPT TO addresses from the SMTP envelope, not the TO addresses from the mail header.
    • setMimeMessage

      public void setMimeMessage(jakarta.mail.internet.MimeMessage message)
      Sets or overwrites the contents of the mail message, including all mail headers and the body.
      Parameters:
      message - The message that was sent.
    • toString

      public String toString()
      Overrides:
      toString in class Object