I don't know if I fixed this at the right point, but I had an issue with quoted-printable mails from our ticket system. The result was that I received messages where ä, ö and others were =C3, =A4 etc.
So, I wrote a small addition to email2sms -script, here's a diff for original email2sms (from this post):
38a39
> TMPOUTFILE=$(mktemp /var/spool/sms/tmp/smsgw.out.XXXXXX)
40c41
< formail -f -I "To: $destination" < $tmp > $OUTFILE
---
> formail -f -I "To: $destination" < $tmp > $TMPOUTFILE
41a43
> /usr/local/bin/decodequoted.pl $TMPOUTFILE > $OUTFILE
> TMPOUTFILE=$(mktemp /var/spool/sms/tmp/smsgw.out.XXXXXX)
40c41
< formail -f -I "To: $destination" < $tmp > $OUTFILE
---
> formail -f -I "To: $destination" < $tmp > $TMPOUTFILE
41a43
> /usr/local/bin/decodequoted.pl $TMPOUTFILE > $OUTFILE
'diff' Syntax Highlight powered by GeSHi
And here's the (butt ugly) decodequoted.pl:
#!/usr/bin/perl
my $file = $ARGV[0];
unless(-e $file) {
die "$file not found!\n";
}
# If there's no MIME -header just pass the file trough
# This IS NOT an fool proof way, but hopefully enough
my $mimetest=`grep '^MIME-Version' $file|wc -l`;
if($mimetest == 0) {
open CONTENT, $file or die "ARRG!\n";
while (<CONTENT>) {
if($_ =~ /^To:\s+.*<(\S+\@\S+)>.*$/) {
print "To: ".$1."\n";
} else {
print $_;
}
}
exit 0;
}
my $metamail=`metamail -w -x -y $file`;
my @rows = split("\n",$metamail);
my $headers;
my $headerson=1;
my $tmpfile;
foreach (@rows) {
if($headerson==1) {
if($_ =~ /^To:\s+.*<(\S+\@\S+)>.*$/) {
$headers.="To: ".$1."\n";
} else {
$headers.=$_."\n";
}
}
if($_=~/^$/) {
$headerson=0;
}
if($_=~/^Wrote.file/) {
$tmpfile=$_;
$tmpfile=~s/Wrote.file.//;
}
}
open CONTENT, $tmpfile or die "ARGG!\n";
print $headers."\n";
while (<CONTENT>) {
print $_;
}
close CONTENT;
unlink($tmpfile);
unlink($file);
my $file = $ARGV[0];
unless(-e $file) {
die "$file not found!\n";
}
# If there's no MIME -header just pass the file trough
# This IS NOT an fool proof way, but hopefully enough
my $mimetest=`grep '^MIME-Version' $file|wc -l`;
if($mimetest == 0) {
open CONTENT, $file or die "ARRG!\n";
while (<CONTENT>) {
if($_ =~ /^To:\s+.*<(\S+\@\S+)>.*$/) {
print "To: ".$1."\n";
} else {
print $_;
}
}
exit 0;
}
my $metamail=`metamail -w -x -y $file`;
my @rows = split("\n",$metamail);
my $headers;
my $headerson=1;
my $tmpfile;
foreach (@rows) {
if($headerson==1) {
if($_ =~ /^To:\s+.*<(\S+\@\S+)>.*$/) {
$headers.="To: ".$1."\n";
} else {
$headers.=$_."\n";
}
}
if($_=~/^$/) {
$headerson=0;
}
if($_=~/^Wrote.file/) {
$tmpfile=$_;
$tmpfile=~s/Wrote.file.//;
}
}
open CONTENT, $tmpfile or die "ARGG!\n";
print $headers."\n";
while (<CONTENT>) {
print $_;
}
close CONTENT;
unlink($tmpfile);
unlink($file);
This seems to work (with my needs), but if you break something you own all the parts

Obviously the real solution would be to rewrite original email2sms to handle quoted printable and other issues properly, but since I don't have the time for that right now I just wrote that workaround.