foxcpp / maddy

✉️ Composable all-in-one mail server.
https://maddy.email
GNU General Public License v3.0
5k stars 240 forks source link

CreateMessage error when trying to add a message #540

Open Oreolek opened 1 year ago

Oreolek commented 1 year ago

Tried to copy a message from another account.

CreateMessage (extractCachedData): message: malformed MIME header key: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http.

The message in question is an old invoice email that starts like this:

Content-Type: text/html; charset=utf8
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
<title>Чек об оплате</title>
</head>
<body>

So it announces itself like UTF-8 but actually it's UTF-8 displayed as Windows-1252 or so? Subject line is also malformed in a similar fashion. Also note the double <head> tag.

No error in log files, this is only what Thunderbird displays and Thunderbird truncated the response.

Log files

Log file is empty. (to clarify: completely empty with debug 0 and no lines about this with debug 1)

Server

maddy 0.6.2 linux/amd64 go1.18.3

storage.imapsql local_mailboxes {
    driver postgres
}

I'd like to:

foxcpp commented 1 year ago
Content-Type: text/html; charset=utf8
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

There is no empty line separating message header and body, hence maddy fails to parse it. Currently such messages cannot be stored or processed by maddy.