#371 Bug for virus DSN + non English subject + solution

Curtis MacDuff

If Amavis is bouncing virus emails and a virus email comes through that has a Japanese subject (I tested with Japanese, I assume this same thing happens with other languages) then the subject will not be printed correctly in the DSN template.

The problem is the majority of email clients (found this behavior in Thunderbird and Outlook Express, didn't feel like testing beyond that) will base64 encode the subjects if they are in Japanese (again I would assume this happens for any non English language). Then the original subject ends up looking like this in the DSN email send back to the sender:

To fix this it needs to be decoded, I did this in the marco_header_field subroutine but it might not be the best place for it. Anywise, before returning the string I added these lines:
sub macro_header_field {
#... unchanged code original in this sub ...
if(/^=\?[^\?]+\?B\?(.+)\?=/) {
$_ = decode_base64($1);

Anywise, having this code seems to work (when getting the DSN I get Japanese text instead of a bunch of gibberish).


  • Curtis MacDuff
    Curtis MacDuff

    • summary: Bug for virus DSN + non English subject --> Bug for virus DSN + non English subject + solution