Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7446893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:27:31+00:00 2026-05-29T12:27:31+00:00

I decided to dive into perl with some of the starter scripts on their

  • 0

I decided to dive into perl with some of the starter scripts on their site. I started with http://learn.perl.org/examples/email.html to try a basic email sending script.

Here’s the actual code:

#!/usr/bin/perl
use strict;
use warnings;

#Character encoding var
my $encoding='text/plain; charset="iso-8859-5"';

#Create the message
use Email::MIME;
my $message = Email::MIME->create(
        header_str => [
                From => 'gmail@gmail.com',
                To => 'gmail2@gmail.com',
                Subject => 'I sent you this message using Perl.',
        ],
        body_str => 'I sent you this message using Perl.  One of those languages that would\' would\'ve been helpful much sooner in my life...',
        );
use Email::Sender::Simple qw(sendmail);
sendmail($message);

What I get when I do perl script.pl is an error message of

body_str was given, but no charset is defined at /usr/local/share/perl/5.10.1/Email/MIME.pm line 243
    Email::MIME::create('Email::MIME', 'header_str', 'ARRAY(0x9a04818)', 'body_str', 'I sent you this message using Perl.  One ...') called at script.pl line 10

I did some searching around the Email::MIME module and found the body_str section but it didn’t shed any light on the error message. I’m assuming I need to set the encoding but I’m not sure how to go about doing it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T12:27:32+00:00Added an answer on May 29, 2026 at 12:27 pm

    If you have a look at the SYNOPSIS section of the docs, you’ll see that you can also pass an “attributes” hashref to create(). You can define charset here. You may also find that you’ll need to define encoding here as well. For example, you could do:

    my $message = Email::MIME->create(
        header_str => [
                From    => 'gmail@gmail.com',
                To      => 'gmail2@gmail.com',
                Subject => 'I sent you this message using Perl.',
        ],
        attributes => {
            encoding => 'quoted-printable', 
            charset  => "US-ASCII",
        },
        body_str => 'I sent you this message using Perl.  One of those languages that would\' would\'ve been helpful much sooner in my life...',
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've decided to dive into some code written in C, and I'd like to
I decided to include some SQL Scripts into VS2010 for ease of editing /
I decided to play with some CSS3 and ran into some problems with background
I decided to dive into AJAX with help of jQuery, and I'm stuck already...
Decided to try and learn Perl, and currently need to process a number of
I'm a long-time Flash developer who's recently decided to dive into HTML-based web apps,
I decided to learn Assembly language. The main reason to do so is being
I decided to learn HTML so I installed apache on windows vista. Everything seems
I decided to learn concurrency and wanted to find out in how many ways
Decided to move one of my project from iBatis to MyBatis and ran into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.