defguard icon indicating copy to clipboard operation
defguard copied to clipboard

Messages are sent in HTML with text/plain content type

Open tema-mazy opened this issue 7 months ago • 6 comments

Describe the bug Messages are sent in HTML with text/plain content type - so they are unreadable

Subject: Defguard: new device added to your account
Date: Tue, 03 Jun 2025 13:30:09 +0000

Mime-Version: 1.0
Content-Type: **text/plain**; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

<!doctype html>
<html xmlns=3D"http://www.w3.org/1999/xhtml" xmlns:v=3D"urn:schemas-microso=
ft-com:vml"
  xmlns:o=3D"urn:schemas-microsoft-com:office:office">

To Reproduce Send any mail

Version information

  • Defguard Core version: v1.2.4

Screenshots

Image

tema-mazy avatar Jun 03 '25 13:06 tema-mazy

@moubctez Assign to Kuba: send messages in plain text and HTML

kchudy avatar Jun 09 '25 08:06 kchudy

@tema-mazy Please specify what email client (and version) you see this errors in. In typical we test (macOS apple mail, gmail, ...) we can't reproduce the bug.. thank you

teon avatar Jun 09 '25 18:06 teon

@teon thanks for taking attention to this issue,

no matter what client is - apple mail, gmail web etc. the message body has wrong content type set and does not display properly.

Image Image Image

so if you are sending html messages - you must use Content-Type: text/plain; charset="UTF-8"

best practice is to send multipart messages - with both text and HTML parts.

`MIME-Version: 1.0

--_part-s0l2BWWS5A9o6GyqII3ygA Content-Type: multipart/alternative; boundary="_part-8X2H-tQVdLqY8d5lldzSjw"

--_part-8X2H-tQVdLqY8d5lldzSjw Content-Type: text/plain; charset="UTF-8"

TEXT VERSION

--_part-8X2H-tQVdLqY8d5lldzSjw Content-Type: multipart/related; boundary="_av--byNXhbcNI9bgr_GYduNbw"

--_part--byNXhbcNI9bgr_GYduNbw Content-Type: text/html; charset="UTF-8"

Html version `

tema-mazy avatar Jun 10 '25 07:06 tema-mazy

@tema-mazy Defguard Core v1.2.4 always sends email with Content-Type=text/html. Isn't your mail processed by the mail server somehow? What if you try a different mail server?

moubctez avatar Jun 10 '25 09:06 moubctez

we do not have problems with other software sending via this server. mails sent in html - shows ok

Image

"Defguard Core v1.2.4 always sends email with Content-Type=text/html." maybe you have wrong headers. i have created simple html mime message and sent it via sendmail -i -- [email protected] < message

  • it shows as html, and this is not multipart
Image Image

also defguard-style message ( without mime type and message-id) - not shown as html

Image Image

the difference - MIME-Version: 1.0 header Image

with it - message processeed corrrectly. without - no

tema-mazy avatar Jun 10 '25 10:06 tema-mazy

missed in release 1.5.0

tema-mazy avatar Sep 16 '25 18:09 tema-mazy