Package com.icegreen.greenmail.mail
Class MovingMessage
- java.lang.Object
-
- com.icegreen.greenmail.mail.MovingMessage
-
public class MovingMessage extends Object
Contains information for delivering a mime email.
-
-
Constructor Summary
Constructors Constructor Description MovingMessage()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRecipient(MailAddress s)Adds an address from which the email was sent.AuthenticationStategetAuthenticationState()Retrieves the state object with the data used for authentication.jakarta.mail.internet.MimeMessagegetMessage()Retrieves the contents of the mail message, including all mail headers and the body.MailAddressgetReturnPath()Retrieves the address from which the email was sent.List<MailAddress>getToAddresses()Retrieves the addresses from which the email was sent.voidremoveRecipient(MailAddress s)Removes an address from the list of addresses from which the email was sent.voidsetAuthenticationState(AuthenticationState authenticationState)Retrieves the state object with the data used for authentication.voidsetMimeMessage(jakarta.mail.internet.MimeMessage message)Sets or overwrites the contents of the mail message, including all mail headers and the body.voidsetReturnPath(MailAddress fromAddress)Sets or overwrites the address from which the email was sent.StringtoString()
-
-
-
Method Detail
-
getAuthenticationState
public AuthenticationState getAuthenticationState()
Retrieves the state object with the data used for authentication. CurrentlyPLAINandLOGINauthentication is supported. You can use this, for example, to retrieve the username or password that was sent by the client. Note that this will returnnullwhen no authentication was performed or needed.- Returns:
- The state used by the AUTH command, if any.
-
setAuthenticationState
public void setAuthenticationState(AuthenticationState authenticationState)
-
getToAddresses
public List<MailAddress> getToAddresses()
Retrieves the addresses from which the email was sent. Note that these are theRCPT TOaddresses from the SMTP envelope, not theTOaddresses 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 theMAIL FROMaddress from the SMTP envelope, not theFROMaddress(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 theMAIL FROMaddress from the SMTP envelope, not theFROMaddress(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 theRCPT TOaddresses from the SMTP envelope, not theTOaddresses 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 theRCPT TOaddresses from the SMTP envelope, not theTOaddresses 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.
-
-