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

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

Thread Next
Peter J . Holzer
September 21, 2006 16:20
[perl #40386] Set charset for Mail::Audit::reply
Message ID:
# 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: >

This is a bug report for perl from,
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 

---	2006-09-19 13:33:25.000000000 +0200
+++	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));

[Please do not change anything below this line]
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:
    osname=linux, osvers=2.6.10-1.9_fc2, archname=i686-linux
    uname='linux 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
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    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/, so=so, useshrplib=false, libperl=libperl.a
  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:

Environment for perl v5.8.6:
    LOGDIR (unset)
    PERL_BADLANG (unset)

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About