deno-smtp
deno-smtp copied to clipboard
diacritical characters on subject field will not be interpreted correctly with icloud.com mail boxes
Hello Sir thanks for this contribution
Here is my workaround:
import * as base64 from "https://denopkg.com/chiefbiiko/base64/mod.ts";
import { SmtpClient } from "https://deno.land/x/smtp/mod.ts"
const diacritic = 'ça va?'
const b64: string = base64.fromUint8Array(new TextEncoder().encode(diacritic));
console.log(b64)
console.log(btoa(diacritic)) // will not output the same as previous
const to = '[email protected]'
const content = 'content with àccent'
const client = new SmtpClient({ content_encoding: "7bit" })
const subject = `=?utf-8?B?${b64}?=`
const connectConfig: any = { hostname: "in-v3.mailjet.com", port: 465, username: "", password: '' }
await client.connectTLS(connectConfig)
await client.send({ from: '[email protected]', to, subject, content })
await client.close()
console.log('finish')
:bulb: Note that I had to do the same thing (which is only documented in the official commands of smtp) for the node smtp-client package
Sorry, I don't know anything about "diacritical characters". Can you submit PR and use specific test cases to solve your problem?
Ok but its simple to test. Just send you an email with Latin accents (or chineese symbols if you prefer) character in your subject to an iCloud inbox and you will see the results diacritic
Thank you so much for the workaround, @chisNaN!