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

这一生的挚爱 提交于 2019-12-06 15:28:06

问题


My .procmailrc (really simple):

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

So, sender named "mail@domain.com" sends message with subject "Subject test ąść". The script "send_sms.sh" receives:

Sender: =?UTF-8?Q?mail@domain.com?= <mail@domain.com>

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:


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.



来源:https://stackoverflow.com/questions/11726354/sendmail-procmail-get-mail-sender-and-mail-subject-utf8-encoding-issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!