Sendmail/procmail - get mail sender and mail subject, utf8 encoding issues

2.6k Views Asked by At

My .procmailrc (really simple):

:0c
| $HOME/send_sms.sh "`formail -xFrom:`" "`formail -xSubject:`"

So, sender named "[email protected]" sends message with subject "Subject test ąść". The script "send_sms.sh" receives:

Sender: [email protected]?= <[email protected]>

Subject: =?UTF-8?Q?Subject_test_=C4=85=C5=9B=C4=87?=

How should I modify my .procmailrc to get clear text? Or convert this in my script send_sms.sh ?

1

There are 1 best solutions below

0
On BEST ANSWER

http://metacpan.org/pod/Email::MIME::RFC2047::Decoder has a simple RFC2047 decoder in Perl. You should perhaps only decode strings which are in a character set you can support, but all your examples are in UTF-8, so if your script supports sending UTF-8 in SMS, you should be fine. For other character sets, perhaps you can convert into UTF-8 in a separate step before sending.