Leser: 11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
use MIME::Entity; #========================================================================== ### Create the top-level, and set up the mail headers: $top = MIME::Entity->build(Type => "multipart/mixed", From => 'sender@domain.example', To => 'recipient@domain.example', Path => $body_path, Subject => "MIME Test + attachment"); $body_path = "/home/jk/cpe/nachricht.txt"; $att_1_path = "/home/jk/cpe/libnet-1.22.tar"; ### Attachment #1: a simple text document: $top->attach(Path=>$body_path, Type=>"Text/plain", Encoding=>"quoted-printable", Disposition => 'inline'); ### Attachment #1: a simple text document: $top->attach(Path=>$att_1_path, Type=>"Application/X-tar", Disposition=>"attach", Encoding=>"base64"); $top->dump_skeleton(\*STDERR); $top->smtpsend(host=>"localhost"); #==========================================================================
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Content-type: multipart/mixed
Effective-type: multipart/mixed
Body-file: NONE <============================
Subject: MIME Test + attachment
Num-parts: 2
--
Content-type: text/plain
Effective-type: text/plain
Body-file: /home/jk/cpe/nachricht.txt
Recommended-filename: nachricht.txt
--
Content-type: application/x-tar
Effective-type: application/x-tar
Body-file: /home/jk/cpe/libnet-1.22.tar
Recommended-filename: libnet-1.22.tar
--