diff --git a/README.md b/README.md index 2d942b1..1450deb 100644 --- a/README.md +++ b/README.md @@ -275,6 +275,7 @@ export interface SendConfig { */ internalTag?: string | symbol; headers: Record; + rawSubject?: boolean; } ``` @@ -307,6 +308,14 @@ to binary. This can be used with preprocessors so you can give mail a type, for example `'registration'`, `'newsletter'` etc. supports symbols and strings. +#### rawSubject + +The library always encodes the email subject to quoted-printable to conform to the standards. + +Unfortunately, some popular UI clients, for example, Gmail, do not display quoted-printable subjects correctly. Instead, though, they deal perfectly with non-ascii values in the subject, displaying them correctly. + +`rawSubject` option disables quoted-printable encoding for the subject. + ### Allowed Mail Formats A single address `mail@example.de` with the name `NAME` can be encoded in the diff --git a/config/mail/mod.ts b/config/mail/mod.ts index 80ad9b5..e8a4578 100644 --- a/config/mail/mod.ts +++ b/config/mail/mod.ts @@ -39,6 +39,7 @@ export interface SendConfig { */ internalTag?: string | symbol; headers?: Headers; + rawSubject?: boolean; } export interface ResolvedSendConfig { @@ -76,6 +77,7 @@ export function resolveSendConfig(config: SendConfig): ResolvedSendConfig { attachments, internalTag, headers, + rawSubject, } = config; return { @@ -91,7 +93,7 @@ export function resolveSendConfig(config: SendConfig): ResolvedSendConfig { }), replyTo: replyTo ? parseSingleEmail(replyTo) : undefined, inReplyTo, - subject: quotedPrintableEncodeInline(subject), + subject: rawSubject ? subject : quotedPrintableEncodeInline(subject), attachments: attachments ? attachments.map((attachment) => resolveAttachment(attachment)) : [],