Package org.apache.sling.testing.clients.email

# Class EmailMessage

java.lang.Object
org.apache.sling.testing.clients.email.EmailMessage

public final class EmailMessage extends Object
Holds information retrieved from the mock SMTP server deployed in Sling

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`HEADER_FROM`
`static final String`
`HEADER_SUBJECT`
`static final String`
`HEADER_TO`

## Constructor Summary

Constructors
Constructor
Description
`EmailMessage(String content)`

## Method Summary

Modifier and Type
Method
Description
`void`
`addHeader(String key, String value)`
Adds a new header to this email message
`String`
`getContent()`
Returns the contents of the email
`String`
`getHeader(String key)`
Returns the value of one of the headers of this email
`Map<String,String>`
`getHeaders()`
Returns an unmodifiable view over the email headers

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### HEADER_FROM

public static final String HEADER_FROM

See Also:
  - Constant Field Values

### HEADER_TO

public static final String HEADER_TO

See Also:
  - Constant Field Values

### HEADER_SUBJECT

public static final String HEADER_SUBJECT

See Also:
  - Constant Field Values

## Constructor Details

### EmailMessage

public EmailMessage(String content)

## Method Details

### addHeader

public void addHeader(String key, String value)
Adds a new header to this email message

Parameters:
  `key` - the header name
  `value` - the header value

### getHeader

public String getHeader(String key)
Returns the value of one of the headers of this email

Parameters:
  `key` - the header name
Returns:
  the value of the header, possibly `null`

### getHeaders

public Map<String,String> getHeaders()
Returns an unmodifiable view over the email headers

Returns:
  the headers

### getContent

public String getContent()
Returns the contents of the email

Returns:
  the email content