how to mail from console with charset in the header?


I'm trying to mail localized text from asterisk to my mail,

echo "тест" | mail -a "Content-Type: text/plain; charset=UTF-8" -s "килирилица"

but mail hasn't -a key. I'm used this key in linux-system. How I can do it in FreeBSD?

There is a way to make the regular mail(1) working with extra headers. The following command adds a new line and the subsequent custom header:
echo работает | mail -s "`echo -e 'проверка\nContent-Type: text/plain; charset=UTF-8'`"
However, it's not portable and works only in sh(1) or bash(1).
tcsh(1) uses a built-in echo which does not interpret "\n". In a shell script you can use a literal new line, and it works in all shells:
echo Работает! | mail -s "проверка кодировки
Content-Type: text/plain; charset=UTF-8"