自分のサイトでいくつかのスタータースクリプトを使ってperlに飛び込むことにしました。私はhttp://learn.perl.org/examples/email.htmlで始まり、基本的な電子メール送信スクリプトを試してみました。Perl電子メールスクリプト - コンテンツエンコーディングの問題
はここで実際のコードです:
#!/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 => '[email protected]',
To => '[email protected]',
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);
私はperl script.pl
を行うときに、私は何を得るの
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
のエラーメッセージである私は、電子メール:: MIMEモジュールの周りにいくつかの検索を行なったし、body_strを見つけましたエラーメッセージに何も表示されませんでした。私はエンコーディングを設定する必要があると思っていますが、それをやり遂げる方法はわかりません。
@cjmのおかげで、この例は修正されました。ありがとうございました! –