develooper Front page | perl.perl5.porters | Postings from September 2006

[perl #40386] Set charset for Mail::Audit::reply

Thread Next
From:
Peter J . Holzer
Date:
September 21, 2006 16:20
Subject:
[perl #40386] Set charset for Mail::Audit::reply
Message ID:
rt-3.5.HEAD-31251-1158854374-622.40386-75-0@perl.org
# New Ticket Created by  Peter J. Holzer 
# Please include the string:  [perl #40386]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=40386 >



This is a bug report for perl from hjp@hjp.at,
generated with the help of perlbug 1.35 running under perl v5.8.6.


-----------------------------------------------------------------
[Please enter your report here]

This patch for Mail::Audit adds a charset parameter to the reply method.
This is useful if you want to send replies in any other language than 
English.


--- Audit.pm.2006-09-21T17:46:00	2006-09-19 13:33:25.000000000 +0200
+++ Audit.pm	2006-09-21 17:51:12.000000000 +0200
@@ -832,9 +832,11 @@
 Sends an autoreply to the sender of the message.  Return value: the recipient
 address of the reply.
 
-Recognized content-related options are: from, subject, cc, bcc, body.  The "To"
-field defaults to the incoming message's "Reply-To" and "From" fields.  C<body>
-should be a single multiline string.
+Recognized content-related options are: from, subject, cc, bcc, body, charset.
+The "To" field defaults to the incoming message's "Reply-To" and "From" fields.
+C<body> should be a single multiline string.
+If C<charset> is given, the reply will contain a Content-Type: text/plain header
+with the given charset.
 
 Set the option C<EVEN_IF_FROM_DAEMON> to send a reply even if the original
 message was from some sort of automated agent.  What that set, only X-Loop will
@@ -933,6 +935,12 @@
   $headers{"X-Loop"}   = $reply_opts{"x-loop"} || $self->get("X-Loop") || "1";
   $headers{"X-Loop-Detect"} = $self->get("X-Loop-Detect") || "1";
 
+  if ($reply_opts{"charset"}) {
+    $headers{"MIME-Version"} = "1.0";
+    $headers{"Content-Type"} = "text/plain; charset=" . $reply_opts{"charset"};
+  }
+
+
   my $reply = Mail::Mailer->new(qw(sendmail));
 
   $reply->open(\%headers);


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=wishlist
---
Site configuration information for perl v5.8.6:

Configured by hjp at Sat Mar  5 12:04:52 CET 2005.

Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
  Platform:
    osname=linux, osvers=2.6.10-1.9_fc2, archname=i686-linux
    uname='linux bernon.wsr.ac.at 2.6.10-1.9_fc2 #1 thu jan 13 17:54:57 est 2005 i686 i686 i386 gnulinux '
    config_args='-ds -e'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -I/usr/local/include -I/usr/include/gdbm'
    ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.3 2.96-126)', gccosandvers='linux7'
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.3.3.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.3.3'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.8.6:
    /usr/local/lib/perl5/5.8.6/i686-linux
    /usr/local/lib/perl5/5.8.6
    /usr/local/lib/perl5/site_perl/5.8.6/i686-linux
    /usr/local/lib/perl5/site_perl/5.8.6
    /usr/local/lib/perl5/site_perl
    .

---
Environment for perl v5.8.6:
    HOME=/home/camel
    LANG=en_US.UTF-8
    LANGUAGE=en_AT:en_US:en_GB:en
    LC_COLLATE=POSIX
    LD_LIBRARY_PATH=/usr/local/oracle/app/oracle/product/8.1.7/lib:/usr/local/lib
    LOGDIR (unset)
    PATH=/home/camel/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin/X11:/bin:/usr/bin:/usr/games:/usr/local/oracle/app/oracle/product/8.1.7/bin:/usr/X11R6/bin
    PERL_BADLANG (unset)
    SHELL=/bin/zsh


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About