# Interface MailService (5.0.3)

    public interface MailService

The `MailService` provides a way for user code to send emails
to arbitrary destinations.

## Methods

### send(MailService.Message message)

    public abstract void send(MailService.Message message)

Sends a mail that has been prepared in a MailService.Message.


The message will be delivered asynchronously, and delivery problems
will result in a bounce to the specified sender.


`Sender` and at least one of the collections for `to, cc, bcc`
must not be `null`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `message` | `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.mail.MailService.Message` The message to be sent. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` | when incorrect arguments are passed. |

### sendToAdmins(MailService.Message message)

    public abstract void sendToAdmins(MailService.Message message)

Send an email alert to all admins of an application.


The message will be delivered asynchronously, and delivery problems
will result in a bounce to the admins.


The content of the `to, cc, bcc` fields should be `
null`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `message` | `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.mail.MailService.Message` The message to be sent. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` | when incorrect arguments are passed. |