I'm emailing content that's in utf-8, and when using the Email plugin
I would get "Wide character" errors when Net::Cmd was writing via

First question:

Should the Email plugin look for utf-8 in the "body" and change the
encoding? Is that the realm of the plugin or should that be in client

In my application base class I'm now doing:

sub email {
my $c = shift;
my $email = ref $_[0] ? shift : {@_};

if ( $email->{body} && utf8::is_utf8( $email->{body} ) ) {
$email->{body} = encode( 'utf8', $email->{body} );
$email->{attributes}{encoding} = 'base64';
$email->{attributes}{charset} = 'utf-8';

$c->SUPER::email( %$email );


which adds these headers:

Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64

and encodes the body as base64.

Would that be useful as a standard part of the Email plugin?

Second question:

What is the opinion on how to send the mail? The default is to use SMTP
to localhost.

In general, I prefer to use sendmail (qmail-inject/exim/postfix)
to inject mail via a pipe. But, using the sendmail interface has its
own problems, such as using -f to set the sender and configuring to be a
"trusted" user, and potentially forking multiple times when sending a
number of emails. Also seem more likely with SMTP that sending email
might end up delayed.

Sending multiple emails with $c->email doesn't seem great, either, as
each is a separate smtp connection. I'm not sending that many emails
at once (30 or 40), still it doesn't seem ideal to do that in the
middle of a http request.

Bill Moseley
moseley at hank.org

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedApr 17, '06 at 5:27p
activeApr 17, '06 at 5:27p

1 user in discussion

Bill Moseley: 1 post



site design / logo © 2021 Grokbase