Interface EmailAttachment

Email attachment interface of Nodemailer.

interface EmailAttachment {
    content?: string | Buffer;
    contentType?: string;
    encoding?: string;
    filename?: string | false;
    headers?: Headers;
    path?: string;
    raw?: string | Buffer;
}

Properties

content?: string | Buffer

String, Buffer or a Stream contents for the attachmentent

contentType?: string

Optional content type for the attachment, if not set will be derived from the filename property

encoding?: string

If set and content is string, then encodes the content to a Buffer using the specified encoding. Example values: base64, hex, binary etc. Useful if you want to use binary attachments in a JSON formatted e-mail.

filename?: string | false

Filename to be reported as the name of the attached file, use of unicode is allowed. If you do not want to use a filename, set this value as false, otherwise a filename is generated automatically .

headers?: Headers

Additional headers

path?: string

Path to a file or an URL (data uris are allowed as well) if you want to stream the file instead of including it (better for larger attachments).

raw?: string | Buffer

Optional value that overrides entire node content in the mime message. If used then all other options set for this node are ignored.