Date: Tue, 23 Mar 2010 13:29:27 +0100 From: Matthias Apitz <guru@unixarea.de> To: freebsd-questions@freebsd.org Subject: sendmail && UTF-8 Message-ID: <20100323122927.GA4059@current.Sisis.de>
next in thread | raw e-mail | index | archive | help
Hello,
I want to sendout mail the following way:
sendmail -t < filename
where the file 'filename' contains some header lines, especially To:
Subject: and From: and as well the body of the mail; all is in UTF-8
and I know I have to encode the header lines and says something about
the body. With Perl it goes like this:
#!/usr/bin/perl
use utf8;
use Encode;
open (MAIL, "|/usr/lib/sendmail -t");
$x="Subject: ... with some UTF-8 chars";
$x_for_header = Encode::encode('MIME-Q', $x);
print MAIL "From: .......\n";
print MAIL "To: .......\n";
print MAIL $x_for_header."\n";
print MAIL "Content-type: text/xml\;charset=UTF-8\n";
print MAIL "Content-Transfer-Encoding: 8bit\n";
print MAIL "\n";
... now the plain UTF-8 body follows
close(MAIL) || warn "Error closing mail: $!";
}
How can I encode the header lines (like the above Subject: line) not
using Perl, i.e. with plain shell tools; I've checked out metamail and
such stuff, but they don't help. Any idea? Thanks in advance
matthias
--
Matthias Apitz
t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211
e <guru@unixarea.de> - w http://www.unixarea.de/
Solidarity with the imperialistic Israel? Not in my name!
¿Solidaridad con el imperialismo de Israel? ¡No en mi nombre!
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100323122927.GA4059>
