haraka / Haraka

A fast, highly extensible, and event driven SMTP server
https://haraka.github.io
MIT License
5.02k stars 662 forks source link

Encoding error with add_body_filter #1417

Closed DarkSorrow closed 8 years ago

DarkSorrow commented 8 years ago

Haraka version

Git pull from 11 april 2016

Expected behavior

Mail arriving with correct encoding like test rréé èè

Observed behavior

Instead its arriving with test rréé èè

Steps to reproduce

I sent a mail with outlook and a smtp tool (SendSMTP) with a body like "test rréé èè" and "tést" as subject. The subject isn't broken when it arrives on my gmail box, the same code worked in the previous haraka version i had (from december / january). I tried this simple

This is the code i just tried

var plugin = exports
//var fs = require('fs');

exports.register = function () {
        plugin.register_hook('data', 'add_hfcontent');
}

exports.add_hfcontent = function (next, connection) {
        connection.transaction.notes.banner = false;
        connection.logcrit("inside the filter beginning");
        connection.transaction.add_body_filter('text/html', function (ct, enc, buf) {
            return(buf);
        });
        return next();
}
DarkSorrow commented 8 years ago

I tried commenting the add_body_filter and send the mail and i could see it on gmail without the accentueted characters broken