Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Email::MIME requires encoding & charset #35

merged 1 commit into from

4 participants


The "Sending an email" example does not work as written. You get the error "body_str was given, but no charset is defined at /usr/local/share/perl/5.10.1/Email/ line 243". See this question on Stack Overflow.

Also, an email body should normally end with a newline

@madsen madsen Email::MIME requires encoding & charset
  Also, an email body should normally end with a newline
@abh abh merged commit 6e50a44 into perlorg:master


Wouldn't it (maybe) make sense to have the example encode with utf-8 instead?


Well, you have to leave something for the student to figure out. :-)

It doesn't really matter, since the body is actually US-ASCII.


I just noticed that same broken example also appears here on the FAQ page. But that file says "DO NOT EDIT THIS FILE, AUTO GENERATED FROM THE perlfaq", and I'm not sure where the source for that is.


@ranguard the canonical source for the perlfaq is at - or?


Yep, although we prefer patches / pull requests to - which is then released to before going to CPAN.


@madsen Leaving the student to get UTF-8 right is a terrible idea, considering how many skilled programmers get it wrong. I'll merge something derived from the above into the perlfaq that handles UTF-8 properly for the user. The point of the FAQ is to answer hard questions for them, not let them figure out the hard stuff on their own and get it wrong.

@madsen madsen referenced this pull request in perl-doc-cats/perlfaq

Email::MIME requires encoding & charset #30


@madsen - thanks for reporting this - now updated in the perlfaq as well (which will update on the website shortly), I also updated the comment about not to update the file so that it mentions the perlfaq gitrepo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 13, 2012
  1. @madsen

    Email::MIME requires encoding & charset

    madsen authored
      Also, an email body should normally end with a newline
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 2 deletions.
  1. +6 −2 docs/learn/examples/email.html
8 docs/learn/examples/email.html
@@ -13,10 +13,14 @@
To => '',
Subject => 'Happy birthday!',
- body_str => 'Happy birthday to you!',
+ attributes => {
+ encoding => 'quoted-printable',
+ charset => 'ISO-8859-1',
+ },
+ body_str => "Happy birthday to you!\n",
# send the message
use Email::Sender::Simple qw(sendmail);
-[%- END %]
+[%- END %]
Something went wrong with that request. Please try again.