Subject: | Failed to set attr before attached file |
Date: | Thu, 05 Jun 2014 23:52:51 +0400 |
To: | bug-MIME-Lite [...] rt.cpan.org |
From: | Андрей <prepodam [...] mail.ru> |
System info
MIME::Lite version 3.030.
This is perl 5, version 14, subversion 2 (v5.14.2) built for
i686-linux-gnu-thread-multi-64int
Linux 2.6.32-042stab088.4 #1 SMP Thu Apr 3 17:41:05 MSK 2014 i686 i686
i386 GNU/Linux
Bug:
In some cases MIME::Lite do not generate correct messages with attached
file and bcc header.
It depends from the order of the "attach" and "attr".
This code generates correct message and it goes to main recipient and to
bcc recipient:
my $msg = MIME::Lite->new(
From => encode_mimewords( $from, 'Encoding' => 'b', 'Charset'
=> 'UTF-8' ),
To => encode_mimewords( $addr, 'Encoding' => 'b', 'Charset'
=> 'UTF-8' ),
Subject => encode_mimewords( $subject, 'Encoding' => 'b', 'Charset'
=> 'UTF-8' ),
Type => 'text/html; charset=utf-8',
Encoding => 'base64',
Data => $text,
);
$msg->attach(
Type => $type,
Path => $file,
Filename => $filename,
);
$msg->attr( 'BCC' => encode_mimewords( $bcc, 'Encoding' => 'b',
'Charset' => 'UTF-8' ) );
$msg->send();
And this code send message only to recipient, bcc header is ignored
my $msg = MIME::Lite->new(
From => encode_mimewords( $from, 'Encoding' => 'b', 'Charset'
=> 'UTF-8' ),
To => encode_mimewords( $addr, 'Encoding' => 'b', 'Charset'
=> 'UTF-8' ),
Subject => encode_mimewords( $subject, 'Encoding' => 'b', 'Charset'
=> 'UTF-8' ),
Type => 'text/html; charset=utf-8',
Encoding => 'base64',
Data => $text,
);
$msg->attr( 'BCC' => encode_mimewords( $bcc, 'Encoding' => 'b',
'Charset' => 'UTF-8' ) );
$msg->attach(
Type => $type,
Path => $file,
Filename => $filename,
);
$msg->send();
--