diff --git a/types/nodemailer/lib/mailer/index.d.ts b/types/nodemailer/lib/mailer/index.d.ts index 00cf40839c..ece591e30e 100644 --- a/types/nodemailer/lib/mailer/index.d.ts +++ b/types/nodemailer/lib/mailer/index.d.ts @@ -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. */ diff --git a/types/nodemailer/nodemailer-tests.ts b/types/nodemailer/nodemailer-tests.ts index 140b351c6b..c5d428a98e 100644 --- a/types/nodemailer/nodemailer-tests.ts +++ b/types/nodemailer/nodemailer-tests.ts @@ -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