C
C
ChiPer2015-04-06 16:05:42
linux
ChiPer, 2015-04-06 16:05:42

How to set auto-reply encoding in Postfix?

The question is next.
Is available postfix 2.9.6-2
All boxes, transports, BCC, are stored in tables MySQL.
A script was written to implement an auto-response:

#!/bin/bash

sql=`/usr/bin/mysql -u mail -ppass -h localhost mail --skip-column-names -e "SELECT bcc_autoreply_text FROM bcc WHERE bcc_maps='$2'"`

if 
    then
    	/usr/bin/sendemail -f [email protected] -t $1 -o message-charset=utf-8 -u Notify -m $sql
fi

in master.cf, respectively, there is an entry:
autoreply unix  - 	n 	n 	- 	- 	pipe flags=DRhu user=autoreply argv=/etc/postfix/BCC/autoreply ${sender} ${recipient}

In general, the point is. The autoresponder handles emails perfectly. But the autoresponder text itself comes normally only in English encoding. Russian letters come in questions. At the same time, when you try to manually run this script, everything comes up fine in both Russian and English variations. There is a suspicion that something with system locales. But everything seems to be set up fine:
LANG=ru_RU.UTF-8
LANGUAGE=
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
t_q_l, 2015-04-06
@ChiPer

What is the DB encoding?
What if the postix user's locale is not the same as yours, for example, LANG=C?
Try to force the locale in the script:

#!/bin/bash
set LANG=ru_RU.UTF-8

sql=`/usr/bin/mysql -u mail -ppass -h localhost mail --skip-column-names -e "SELECT bcc_autoreply_text FROM bcc WHERE bcc_maps='$2'"`

if 
    then
    	/usr/bin/sendemail -f [email protected] -t $1 -o message-charset=utf-8 -u Notify -m $sql
fi

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question