# Class MailService.Attachment (5.0.3)

    public static class MailService.Attachment

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> MailService.Attachment

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Constructors

### Attachment(String fileName, byte\[\] data)

    public Attachment(String fileName, byte[] data)

Attachments are an optional part of messages, but if present, all
information about them must be provided.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fileName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The attachment must have a filename associated with it. The extension on that filename must be present and not blocked, or there will be a failure at send time. |
| `data` | `byte[]` An array with arbitrary byte content. The array must be be present, but may be of zero length. |

### Attachment(String fileName, byte\[\] data, @Nullable String contentID)

    public Attachment(String fileName, byte[] data, @Nullable String contentID)

Attachments are an optional part of messages, but if present, all
information about them must be provided.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fileName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The attachment must have a filename associated with it. The extension on that filename must be present and blocked, or there will be a failure at send time. |
| `data` | `byte[]` An array with arbitrary byte content. The array must be be present, but may be of zero length. |
| `contentID` | `https://docs.oracle.com/javase/8/docs/api/java/lang/@org/jspecify/annotations/Nullable String.html` The attachment's content ID. May be null. |

## Methods

### getContentID()

    public @Nullable String getContentID()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/@org/jspecify/annotations/Nullable String.html` |   |

### getData()

    public byte[] getData()

Gets the content of this attachment.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `byte[]` | The raw data of this attachment. |

### getFileName()

    public String getFileName()

Gets the file name of this attachment.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The file name of this attachment. |