SMTP mailer a čeština resp. utf-8 znaky v HTMLBody

jannemec
Člen | 78
+
0
-

Mám problém s češtinou u SMTP maileru – nastavení na Office365 – nesetkal se s tím někdo?

V body mi to nebere správně utf znaky, přitom v hlavičce jsou
Subject:
Čeština kontrola 9.12.2022 15:24:25
Body:
?e?tina kontrola body

Nastavení SMTP
`mail:
# použije SmtpMailer
smtp: true
host: smtp.office365.com
port: 587
username: xxxxxxxxxxxxxxxxx
password: xxxxxxxxxxxxxxxxxx
secure: tls `

A samotné HTMLbody je generované jako
`<html>
<head>
<meta charset=„utf-8“>
<title>Čeština</title>
</head>
<body>
<p>Čeština kontrola body</p>
</body>
</html>`

nightfish
Člen | 475
+
0
-

@jannemec Jaký kód používáš k odeslání e-mailu (resp. sestavení Nette\Mail\Message)? Jak to vypadá ve zdrojovém kódu doručeného e-mailu (ideálně někam vystav komplet e-mail včetně všech hlaviček i mime parts).

jannemec
Člen | 78
+
0
-

` $mail = new \Nette\Mail\Message;
$mail->setFrom(‚jnemec@*******.cz', '***** intranet‘);
$mail->addTo(‚jnemec@******.cz');
$mail->setSubject("Čeština kontrola " . date('j.n.Y H:i:s‘));
$html = ‚Čeština kontrola body‘;
$mail->setHtmlBody($html);
$mail->setPriority(\Nette\Mail\Message::NORMAL);
$mail->setEncoding(‚UTF-8‘);
$this->mailerService->send($mail);
`

jannemec
Člen | 78
+
0
-

`
Received: from AS8PR08MB10071.eurprd08.prod.outlook.com
(2603:10a6:20b:633::18) by VI1PR08MB4493.eurprd08.prod.outlook.com with
HTTPS; Fri, 9 Dec 2022 14:24:32 +0000
Received: from FR3P281CA0197.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a5::7) by
AS8PR08MB10071.eurprd08.prod.outlook.com (2603:10a6:20b:633::18) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES256_GCM_SHA384) id 15.20.5880.11; Fri, 9 Dec
2022 14:24:32 +0000
Received: from VE1EUR01FT040.eop-EUR01.prod.protection.outlook.com
(2603:10a6:d10:a5:cafe::a2) by FR3P281CA0197.outlook.office365.com
(2603:10a6:d10:a5::7) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES256_GCM_SHA384) id 15.20.5924.5 via Frontend
Transport; Fri, 9 Dec 2022 14:24:31 +0000
Authentication-Results: spf=fail (sender IP is 20.79.220.33)
smtp.mailfrom=**********.cz; dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=**********.cz;
Received-SPF: Fail (protection.outlook.com: domain of **********.cz does
not designate 20.79.220.33 as permitted sender)
receiver=protection.outlook.com; client-ip=20.79.220.33;
helo=de1-emailsignatures-cloud.codetwo.com;
Received: from de1-emailsignatures-cloud.codetwo.com (20.79.220.33) by
VE1EUR01FT040.mail.protection.outlook.com (10.152.3.46) with Microsoft SMTP
Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES256_GCM_SHA384) id
15.20.5901.17 via Frontend Transport; Fri, 9 Dec 2022 14:24:31 +0000
Received: from EUR04-HE1-obe.outbound.protection.outlook.com (104.47.13.56) by de1-emailsignatures-cloud.codetwo.com with CodeTwo SMTP Server (TLS12) via SMTP; Fri, 09 Dec 2022 14:24:30 +0000
Authentication-Results-Original: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=**********.cz;
Received: from AS2PR08MB9618.eurprd08.prod.outlook.com (2603:10a6:20b:609::20)
by GV2PR08MB9950.eurprd08.prod.outlook.com (2603:10a6:150:b9::9) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES256_GCM_SHA384) id 15.20.5924.6; Fri, 9 Dec
2022 14:24:30 +0000
Received: from AS2PR08MB9618.eurprd08.prod.outlook.com
([fe80::2392:ad7a:4a4d:3ef]) by AS2PR08MB9618.eurprd08.prod.outlook.com
([fe80::2392:ad7a:4a4d:3ef%9]) with mapi id 15.20.5880.014; Fri, 9 Dec 2022
14:24:30 +0000
X-Mailer: Nette Framework
Date: Fri, 9 Dec 2022 15:24:25 +0100
From: CASALE intranet <jnemec@**********.cz>
To: jnemec@**********.cz
Subject: =?UTF-8?B?xIxlxaF0aW5hIGtvbnRyb2xhIDIgOS4xMi4yMDIyIDE1OjI=?=
=?UTF-8?B?NDoyOA==?=
Content-Transfer-Encoding: UTF-8
Message-ID: <6dk3nk52f3@localhost>
Content-Type: multipart/alternative; boundary=„--------d46okf9kx9“
X-ClientProxiedBy: FR2P281CA0016.DEUP281.PROD.OUTLOOK.COM
(2603:10a6:d10:a::26) To AS2PR08MB9618.eurprd08.prod.outlook.com
(2603:10a6:20b:609::20)
Return-Path: JNemec@**********.cz
X-MS-Exchange-MessageSentRepresentingType: 1
X-MS-TrafficTypeDiagnostic:
AS2PR08MB9618:EE_|GV2PR08MB9950:EE_|VE1EUR01FT040:EE_|AS8PR08MB10071:EE_
X-MS-Office365-Filtering-Correlation-Id: f0b3d273–250a-4961–6cf2–08dad9f116a3
X-MS-Exchange-AtpMessageProperties: SA|SL
X-Microsoft-Antispam-Untrusted: BCL:0;
X-Microsoft-Antispam-Message-Info-Original:
kZGLjHoEdPVq57oO7CE3wirfwqmos7ALYx5XDZVomy+OhxUKm9nqEsDMA6IqoazK+c/lGdLA6Zuy6s/50CWAjvgIWuVGpqa4LH2yy+9YEzjJQqYI9tB7QvHAYttrIbdI4Lnsk7Ivw26jlk/0UIw44OW8c3Jnb0539H+pGEtNdm3AMCePfcxbC8wprucxx+q2e0DTH+KndmkwJSPTW1L4Quhicq95m4I9kiGN0KOlBVX72ozARn/I+Rh9gCd53bgcX60mAJIacGDEjTRdC0MNXv5chujdFlvyRLZsWe3iDZ7IkLm4AcXlYSLHEXX/DXR1RS8T3vNNNyW2plbssGq855Ufb42the+/PgDWVfrLvNFTGKyOnhInm1PjsXDPhs34xKL8zKCmm92yNkmDFjcuvVUiR3Syp6/jRJATFQp70gJEVps3sHOJwWpobgcDQvYNb5nb5Gbz9KNplsei3g1yQVdZ+ooNeAip345vHoxLS9AfAqvBL14wyxWVkKgvaW0iPyqXiZjdl4N8+Sy0l4CmyaLE7UTWsDjDv4wq4VDUVD6nHA5lZzNbJ4ll03GQV8uzjpi+7Rwm/m1zL3eKNvP5KcExEOSYuD9XcOeuZVVR43NAU/QA02IeClh+BM7JxOdkwAzn+8l+JqABzY9IZVke0Q==
X-Forefront-Antispam-Report-Untrusted:
CIP:255.255.255.255;CTRY:;LANG:cs;SCL:-1;SRV:;IPV:NLI;SFV:SKI;H:AS2PR08MB9618.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:;DIR:INB;
X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB9950
X-OrganizationHeadersPreserved: GV2PR08MB9950.eurprd08.prod.outlook.com
X-CodeTwo-MessageID: 7b1ebdd9-ccea-4370-b90f-0df4a1fccbee.20221209142430@de1-emailsignatures-cloud.codetwo.com
X-CodeTwoProcessed: true
X-MS-Exchange-Organization-ExpirationStartTime: 09 Dec 2022 14:24:31.6501
(UTC)
X-MS-Exchange-Organization-ExpirationStartTimeReason: OriginalSubmit
X-MS-Exchange-Organization-ExpirationInterval: 1:00:00:00.0000000
X-MS-Exchange-Organization-ExpirationIntervalReason: OriginalSubmit
X-MS-Exchange-Organization-Network-Message-Id:
f0b3d273–250a-4961–6cf2–08dad9f116a3
X-EOPAttributedMessage: 0
X-MS-Exchange-Organization-MessageDirectionality: Originating
X-MS-Exchange-Organization-AuthSource: AS2PR08MB9618.eurprd08.prod.outlook.com
X-MS-Exchange-Organization-AuthAs: Internal
X-MS-Exchange-Organization-AuthMechanism: 06
X-MS-Exchange-Organization-SCL: –1
X-CrossPremisesHeadersPromoted:
VE1EUR01FT040.eop-EUR01.prod.protection.outlook.com
X-CrossPremisesHeadersFiltered:
VE1EUR01FT040.eop-EUR01.prod.protection.outlook.com
X-MS-Exchange-Transport-CrossTenantHeadersStripped:
VE1EUR01FT040.eop-EUR01.prod.protection.outlook.com
X-MS-PublicTrafficType: Email
X-OriginatorOrg: 5ukvzr4t82tmk1dnjqv2rkh6×.smtp.codetwo.online
X-MS-Office365-Filtering-Correlation-Id-Prvs:
8bfb34f0–78b9–4e0c-2be6–08dad9f11588
X-Microsoft-Antispam: BCL:0;
X-Forefront-Antispam-Report:
CIP:20.79.220.33;CTRY:DE;LANG:en;SCL:-1;SRV:;IPV:NLI;SFV:SKI;H:de1-emailsignatures-cloud.codetwo.com;PTR:de1-emailsignatures-cloud.codetwo.com;CAT:NONE;SFS:;DIR:INB;
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2022 14:24:31.6032
(UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: f0b3d273–250a-4961–6cf2–08dad9f116a3
X-MS-Exchange-CrossTenant-Id: 78870c77-ab42–4421-b976-e5d2c53eb52c
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78870c77-ab42–4421-b976-e5d2c53eb52c;Ip=[20.79.220.33];Helo=[de1-emailsignatures-cloud.codetwo.com]
X-MS-Exchange-CrossTenant-AuthSource: AS2PR08MB9618.eurprd08.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB10071
X-MS-Exchange-Transport-EndToEndLatency: 00:00:00.9558382
X-MS-Exchange-Processed-By-BccFoldering: 15.20.5880.014
X-Microsoft-Antispam-Mailbox-Delivery:
ucf:0;jmr:0;auth:0;dest:I;ENG:(910001)(944506478)(944626604)(920097)(425001)(930097);
X-Microsoft-Antispam-Message-Info:
kA3ej1k7PlFBB72ksqKXoTgUZ5vIPyi6a7KYHig4F0lK8+bqMQ+anzt4v0NJ+QTG2brl3cqqL4x+1AV0bMAYRA3/aVjP6CBb7POKPAV6TeSWzbIwYOcrfGKBl+QM5TD+OU/WpnjkaIrDXpOUS3FL6z1tiM9idQQTRyEwGhjWMRHVTWCOREk0ekL2vZuXF4xQjK5AlCtKrHd7syWOdiK2eRmmF1zv3tDe7LM6FywEaE32rn94GK70Z6OCZMCjlKwSp/dt2XclmudJRt9iL6FrXaLozbDHle08zCluDyHHLr6dfW/PLd4xUagM44vfoYDQei9eQ0rLwsztQK/uNp31wtg1RStgNZq859hixvLG37V2bgVuahvzj9r3xAugxBmn7LfMQC0VjHrRNmSuER0ehptGJ+KrFv1SHoI3Un8U8MSPl4tl/aB18MLQTGUmeAm3tAWqEd10cRrnmjHAvJn9gaIzEszK0rXRK9yfAPzX+dOLQsKu+j4+mWh0BAybV5AqfJdCFnsBiZ/flWhYjEalVjbXM0tjzGqV+F19×3axFGNIjEGTI28SmdzWvMByDwFzo6e4aEgs0Oxf66l3+tcfTC7xvHOOPFuarLevDFoIDOZZkJ51JDCUB6D34KRTfjCF
MIME-Version: 1.0

----------d46okf9kx9
Content-Type: text/plain; charset=„UTF-8“
Content-Transfer-Encoding: 8bit

?e?tina kontrola body
----------d46okf9kx9
Content-Type: text/html; charset=„UTF-8“
Content-Transfer-Encoding: 8bit

<html><head>
<meta http-equiv=„Content-Type“ content=„text/html; charset=utf-8“>
<title>?e?tina</title>
<style>
</style>
</head>
<body>
<p>?e?tina kontrola 2 body</p>
</body>
</html>
----------d46okf9kx9–
`

nightfish
Člen | 475
+
+2
-

@jannemec Myslím, že za to může volání setEncoding(), protože to nastavuje hlavičku Content-Transfer-Encoding, která by měla nabývat jedné z hodnot BASE64, QUOTED-PRINTABLE, 8BIT, 7BIT nebo BINARY – takže $mail->setEncoding('UTF-8'); zkus smazat.

Zároveň ověř, že soubor, ve kterém máš uveden text „Čeština kontrola“, je uložen v kódování UTF-8.

jannemec
Člen | 78
+
0
-

Tak zdá se, že vyřešeno
`
$mail->setEncoding(\Nette\Mail\MimePart::ENCODING_8BIT);
`

Pomohlo.
Kdyby s tím někdo taky bojoval …