From owner-freebsd-questions@FreeBSD.ORG Tue Mar 23 12:29:32 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF693106564A for ; Tue, 23 Mar 2010 12:29:32 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms16-1.1blu.de (ms16-1.1blu.de [89.202.0.34]) by mx1.freebsd.org (Postfix) with ESMTP id 8836A8FC2A for ; Tue, 23 Mar 2010 12:29:32 +0000 (UTC) Received: from [193.31.11.193] (helo=current.Sisis.de) by ms16-1.1blu.de with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Nu3Ed-0002tG-Mk for freebsd-questions@freebsd.org; Tue, 23 Mar 2010 13:29:27 +0100 Received: from current.Sisis.de (current [127.0.0.1]) by current.Sisis.de (8.14.3/8.14.3) with ESMTP id o2NCTRtO004108 for ; Tue, 23 Mar 2010 13:29:27 +0100 (CET) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by current.Sisis.de (8.14.3/8.14.3/Submit) id o2NCTRum004107 for freebsd-questions@freebsd.org; Tue, 23 Mar 2010 13:29:27 +0100 (CET) (envelope-from guru@unixarea.de) X-Authentication-Warning: current.Sisis.de: guru set sender to guru@unixarea.de using -f Date: Tue, 23 Mar 2010 13:29:27 +0100 From: Matthias Apitz To: freebsd-questions@freebsd.org Message-ID: <20100323122927.GA4059@current.Sisis.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 8.0-CURRENT (i386) X-Con-Id: 51246 X-Originating-IP: 193.31.11.193 Subject: sendmail && UTF-8 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Matthias Apitz List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Mar 2010 12:29:32 -0000 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 - w http://www.unixarea.de/ Solidarity with the imperialistic Israel? Not in my name! ¿Solidaridad con el imperialismo de Israel? ¡No en mi nombre!