Closed caramboleyo closed 2 years ago
Could you provide a minimal code example?
Some mail clients now show ??? instead of Ö Ä Ü ß ö ä ü
import { SMTPClient } from "https://deno.land/x/denomailer/mod.ts";
const client = new SMTPClient({
connection: {
hostname: 'smtp.mailbox.org',
port: 465,
tls: true,
auth: {
username: 'xxx',
password: 'xxx',
},
},
});
console.log('>>>send' , await client.send({
from: 'Önsen Stärebrü <oensen.staerebrue@example.com>',
to: 'Inga Wäregwö <inga.waeregwoe@example.com>',
subject: 'Köttbullar recipe by Önsen Stärebrü',
html: '<html><head></head><body>This <b>is</b> a test.</body></html>',
}));
client.close();
It does not affect the html since there any multipart gets a content-type with utf header.
You can try
import { quotedPrintableEncode } from "https://deno.land/x/denomailer/config/mail/encoding.ts";
const newSubject = quotedPrintableEncode(oldSubject)
might work.
No, that looks like this: K=c3=b6ttbullar recipe by =c3=96nsen St=c3=a4rebr=c3=bc
They seem to wrap it inside =?utf-8?B? .. ?=
and hash it somehow.
It looks like you can do
const newSubject = `=?utf-8?Q?${quotedPrintableEncode(oldSubject)}?=`
I can't reproduce the error with 3 different SMTP-Servers so not sure what to expect...
I created a PR that implements the above fix. (#37)
You can try it by importing denomailer from https://raw.githubusercontent.com/EC-Nordbund/denomailer/feat/encode-mail-name%2Bsubject/mod.ts
Yes, with the new mod.ts file it works out of the box. 👏👏👏
Problem is not on the sending side, it is with the email client you open the mail. Some dont seem to assume the mail head is utf8.
It semes to work (before this fix) with non spec-compliant-clients so this is an important change!
Released in version 1.3.0 thanks a lot for the help!
Hi @mathe42 , When I have ascii chars in my subject it shows weird tags in my email
Is it linked ?
When you use special chars in subject or from in some email clients they are not displayed properly.
I checked an email send with rainloop, where it works, and they seem to escape words containing special chars like this: "=?utf-8?B?w5ZHS1YgS8Okcm50ZW4=?="
Meanwhile is there an escape function to archive this right now? When i copied that string into my send function it was displayed correctly.