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

# Class SlingEmailClient

java.lang.Object
org.apache.sling.testing.clients.AbstractSlingClient
org.apache.sling.testing.clients.SlingClient
org.apache.sling.testing.clients.email.SlingEmailClient

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `org.apache.http.client.HttpClient`

public final class SlingEmailClient extends SlingClient
Accesses email stored by a mock SMTP server deployed to Sling

Requires that the `org.apache.sling.testing.email` bundle is deployed.

## Nested Class Summary

## Nested classes/interfaces inherited from class org.apache.sling.testing.clients.SlingClient

`SlingClient.Builder, SlingClient.InternalBuilder<T extends SlingClient>`

## Field Summary

### Fields inherited from class org.apache.sling.testing.clients.SlingClient

`CLIENT_CONNECTION_TIMEOUT_PROP, DEFAULT_NODE_TYPE, SUDO_COOKIE_NAME`

## Constructor Summary

Constructors
Constructor
Description
`SlingEmailClient(org.apache.http.impl.client.CloseableHttpClient http, SlingClientConfig config)`

## Method Summary

Modifier and Type
Method
Description
`void`
`deleteMessages()`
Deletes all mail messages currently stored
`int`
`getBindPort()`
Retrieves the actual bind port of the SMTP server
`List<EmailMessage>`
`getMessages()`
Retrieves the list of mail messages currently stored

### Methods inherited from class org.apache.sling.testing.clients.SlingClient

`createFolder, createNode, createNodeRecursive, deletePath, doGetJson, endImpersonation, exists, getJsonNode, getJsonNode, getNodeNameFromPath, getParentPath, getUser, getUUId, getUUID, impersonate, importContent, importContent, importJson, move, setPropertiesString, setPropertyString, setPropertyStringArray, upload, waitExists, waitUntilExists`

### Methods inherited from class org.apache.sling.testing.clients.AbstractSlingClient

`adaptTo, addValue, close, doDelete, doGet, doGet, doGet, doHead, doPatch, doPost, doPost, doPut, doRawRequest, doRequest, doStreamGet, doStreamPost, doStreamRequest, execute, execute, execute, execute, execute, execute, execute, execute, getClientId, getConnectionManager, getCookieStore, getCredentialsProvider, getParams, getPassword, getPath, getPath, getUrl, getUrl, getUrl, getValue, getValues, hasValue`

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

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

## Constructor Details

### SlingEmailClient

public SlingEmailClient(org.apache.http.impl.client.CloseableHttpClient http, SlingClientConfig config) throws ClientException

Throws:
  `ClientException`

## Method Details

### getBindPort

public int getBindPort() throws ClientException
Retrieves the actual bind port of the SMTP server

Returns:
  the port value
Throws:
  `ClientException` - in case of any errors

### getMessages

public List<EmailMessage> getMessages() throws ClientException
Retrieves the list of mail messages currently stored

Returns:
  the list of messages, possibly empty
Throws:
  `ClientException` - in case of any errors

### deleteMessages

public void deleteMessages() throws ClientException
Deletes all mail messages currently stored

Throws:
  `ClientException` - in case of any errors