how to mail from console with charset in the header?

Hi,

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

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

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

Thanks/
 
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:
Code:
echo работает | mail -s "`echo -e 'проверка\nContent-Type: text/plain; charset=UTF-8'`" mymail@myserver.com
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:
Code:
echo Работает! | mail -s "проверка кодировки
Content-Type: text/plain; charset=UTF-8" mymail@myserver.com
 
Back
Top