Skip to content
Snippets Groups Projects
Commit fa49a55d authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Support base64-decoding in get_msg_body()

The mail server no longer decodes base64-encoded messages itself
(i.e. due to support of single-part MIME binary file attachments).

So detect a base64-encoded message body and decode it for external
mail processors here.
parent 30d4aa79
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -115,17 +115,20 @@ function convert_msg_header(hdr_array)
// Parses the body portion of the complete message text into an array
function get_msg_body(msgtxt)
{
var body = new Array();
var body = "";
var hdr = true;
var base64 = parse_msg_header(msgtxt)["content-transfer-encoding"] == "base64";
for(i in msgtxt) {
if(hdr && msgtxt[i].length==0) { // Header terminator
hdr = false;
continue;
}
if(!hdr)
body.push(msgtxt[i]);
if(!hdr) {
var line = base64 ? base64_decode(msgtxt[i]) : (msgtxt[i] + "\n");
if(line != null)
body += line;
}
return(body);
}
return(body.split('\n'));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment