When using the following code:
my $mail = Email::Stuffer
->from( 'me@example.com' )
->to( 'you5@example.com' )
->subject( 'Invoice 1' )
->text_body( $body,
encoding => '8bit',
content_type => 'text/plain',
charset => 'utf8' )
->header( 'Message-Id' => 'some-id@example.com' );
Where $body is undef, followed by:
$mail->attach($att->{content},
content_type => $att->{mime_type},
disposition => 'attachment',
filename => $att->{file_name});
Results in:
Content-Transfer-Encoding: base64
Content-Type: application/pdf
Date: Sun, 21 Apr 2024 18:44:05 +0000
From: me@example.com
MIME-Version: 1.0
Message-Id: <17137250450.ab5e3.4060@lsmb>
Received: from localhost.localdomain by mailhog.example (MailHog)
id 4C21yTDtN0a83oBQ64AuQsIPa6LQbd41eVeFpE3iG88=@mailhog.example; Sun, 21 Apr 2024 18:44:05 +0000
Return-Path: <me@example.com>
Subject: Invoice 1
To: you5@example.com
JVBERi0xLjUKJdDUxdgKMyAwIG9iago8PAovTGVuZ3RoIDEzMjUgICAgICAKL0ZpbHRlciAvRmxh
...
aYdWxwplbmRzdHJlYW0KZW5kb2JqCnN0YXJ0eHJlZgoyOTUzOAolJUVPRgo=
Meaning that the body of the mail now has become the attachment. I would have expected something along the lines of:
Content-Transfer-Encoding: 7bit
Content-Type: multipart/mixed; boundary=17137249691.Ab6AfaD9f.4055
Date: Sun, 21 Apr 2024 18:42:49 +0000
From: me@example.com
MIME-Version: 1.0
Message-Id: <17137249690.B89b16C.4055@lsmb>
Received: from localhost.localdomain by mailhog.example (MailHog)
id ZamsOjJ0rDUJIu3gIDx45-C190giHpJV6oje6_3aaPA=@mailhog.example; Sun, 21 Apr 2024 18:42:49 +0000
Return-Path: <me@example.com>
Subject: Invoice 1
To: you4@example.com
--17137249691.Ab6AfaD9f.4055
Date: Sun, 21 Apr 2024 18:42:49 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
--17137249691.Ab6AfaD9f.4055
Date: Sun, 21 Apr 2024 18:42:49 +0000
MIME-Version: 1.0
Content-Type: application/pdf
Content-Disposition: attachment; filename=invoice-1.pdf
Content-Transfer-Encoding: base64
JVBERi0xLjUKJdDUxdgKMyAwIG9iago8PAovTGVuZ3RoIDEzMjUgICAgICAKL0ZpbHRlciAvRmxh
...
aYdWxwplbmRzdHJlYW0KZW5kb2JqCnN0YXJ0eHJlZgoyOTUzOAolJUVPRgo=
--17137249691.Ab6AfaD9f.4055--
When using the following code:
Where
$bodyisundef, followed by:Results in:
Meaning that the body of the mail now has become the attachment. I would have expected something along the lines of: