nodemailer: contentTransferEncoding and contentDisposition values (#28780)

This commit is contained in:
Piotr Roszatycki
2018-09-11 17:16:06 +02:00
committed by Ryan Cavanaugh
parent a20e687b6d
commit 65beaf9330
2 changed files with 13 additions and 7 deletions

View File

@@ -47,9 +47,9 @@ declare namespace Mail {
/** optional content type for the attachment, if not set will be derived from the filename property */
contentType?: string;
/** optional transfer encoding for the attachment, if not set it will be derived from the contentType property. Example values: quoted-printable, base64. If it is unset then base64 encoding is used for the attachment. If it is set to false then previous default applies (base64 for most, 7bit for text). */
contentTransferEncoding?: string;
contentTransferEncoding?: '7bit' | 'base64' | 'quoted-printable' | false;
/** optional content disposition type for the attachment, defaults to attachment */
contentDisposition?: string;
contentDisposition?: 'attachment' | 'inline';
/** is an object of additional headers */
headers?: Headers;
/** an optional value that overrides entire node content in the mime message. If used then all other options set for this node are ignored. */

View File

@@ -123,7 +123,7 @@ function message_attachments_test() {
attachments: [
{ // utf-8 string as an attachment
filename: 'text1.txt',
content: 'hello world!'
content: 'hello world!',
},
{ // binary buffer as an attachment
filename: 'text2.txt',
@@ -138,12 +138,15 @@ function message_attachments_test() {
},
{ // stream as an attachment
filename: 'text4.txt',
content: fs.createReadStream('file.txt')
content: fs.createReadStream('file.txt'),
contentTransferEncoding: 'quoted-printable'
},
{ // define custom content type for the attachment
filename: 'text.bin',
content: 'hello world!',
contentType: 'text/plain'
contentType: 'text/plain',
contentTransferEncoding: '7bit',
contentDisposition: 'attachment'
},
{ // use URL as an attachment
filename: 'license.txt',
@@ -152,10 +155,13 @@ function message_attachments_test() {
{ // encoded string as an attachment
filename: 'text1.txt',
content: 'aGVsbG8gd29ybGQh',
encoding: 'base64'
encoding: 'base64',
contentTransferEncoding: 'base64'
},
{ // data uri as an attachment
path: 'data:text/plain;base64,aGVsbG8gd29ybGQ='
path: 'data:text/plain;base64,aGVsbG8gd29ybGQ=',
contentDisposition: 'inline',
contentTransferEncoding: false
},
{
// use pregenerated MIME node