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.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003e\u003ccode\u003eMailService.Attachment\u003c/code\u003e is a class for managing attachments in messages, inheriting from \u003ccode\u003ejava.lang.Object\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eAttachments require a filename (\u003ccode\u003eString\u003c/code\u003e) and data (\u003ccode\u003ebyte[]\u003c/code\u003e), where the filename's extension must be present and not blocked, and the data array can be of zero length.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAttachment\u003c/code\u003e class provides constructors to create attachments with or without a content ID (\u003ccode\u003eString\u003c/code\u003e), which can be null.\u003c/p\u003e\n"],["\u003cp\u003eMethods available for \u003ccode\u003eAttachment\u003c/code\u003e objects include \u003ccode\u003egetContentID()\u003c/code\u003e, \u003ccode\u003egetData()\u003c/code\u003e, and \u003ccode\u003egetFileName()\u003c/code\u003e to retrieve the respective properties of the attachment.\u003c/p\u003e\n"]]],[],null,["# Class MailService.Attachment (2.0.0)\n\n public static class MailService.Attachment\n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e MailService.Attachment \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nConstructors\n------------\n\n### Attachment(String fileName, byte\\[\\] data)\n\n public Attachment(String fileName, byte[] data)\n\nAttachments are an optional part of messages, but if present, all\ninformation about them must be provided.\n\n### Attachment(String fileName, byte\\[\\] data, @Nullable String contentID)\n\n public Attachment(String fileName, byte[] data, @Nullable String contentID)\n\nAttachments are an optional part of messages, but if present, all\ninformation about them must be provided.\n\nMethods\n-------\n\n### getContentID()\n\n public @Nullable String getContentID()\n\n### getData()\n\n public byte[] getData()\n\nGets the content of this attachment.\n\n### getFileName()\n\n public String getFileName()\n\nGets the file name of this attachment."]]