Mercurial > laserkard
annotate not-used/megamail.pl @ 95:5fb202915c11 laserkard
created card template multifunction
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 26 Jul 2010 21:42:20 -0400 |
parents | 4ebd94bfecda |
children |
rev | line source |
---|---|
rlm@78 | 1 use MIME::QuotedPrint; |
rlm@78 | 2 use MIME::Base64; |
rlm@78 | 3 use Mail::Sendmail 0.75; # doesn't work with v. 0.74! |
rlm@78 | 4 |
rlm@78 | 5 %mail = ( |
rlm@78 | 6 from => 'rlm@mit.edu', |
rlm@78 | 7 to => 'rlm@mit.edu', |
rlm@78 | 8 subject => 'Test attachment', |
rlm@78 | 9 ); |
rlm@78 | 10 |
rlm@78 | 11 |
rlm@78 | 12 $boundary = "====" . time() . "===="; |
rlm@78 | 13 $mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; |
rlm@78 | 14 |
rlm@78 | 15 $message = encode_qp( "email from your friend PERL." ); |
rlm@78 | 16 |
rlm@78 | 17 $file = "./inkscape/arrow.svg"; |
rlm@78 | 18 |
rlm@78 | 19 open (F, $file) or die "Cannot read $file: $!"; |
rlm@78 | 20 binmode F; undef $/; |
rlm@78 | 21 $attach1 = encode_base64(<F>); |
rlm@78 | 22 close F; |
rlm@78 | 23 |
rlm@78 | 24 |
rlm@78 | 25 |
rlm@78 | 26 $attach2 = encode_base64("hi this is a test arttacghjkalsdlasndlashdlsf"); |
rlm@78 | 27 |
rlm@78 | 28 |
rlm@78 | 29 |
rlm@78 | 30 |
rlm@78 | 31 |
rlm@78 | 32 $boundary = '--'.$boundary; |
rlm@78 | 33 $mail{body} = <<END_OF_BODY; |
rlm@78 | 34 $boundary |
rlm@78 | 35 Content-Type: text/plain; charset="iso-8859-1" |
rlm@78 | 36 Content-Transfer-Encoding: quoted-printable |
rlm@78 | 37 |
rlm@78 | 38 $message |
rlm@78 | 39 $boundary |
rlm@78 | 40 Content-Type: application/octet-stream; name="test.svg" |
rlm@78 | 41 Content-Transfer-Encoding: base64 |
rlm@78 | 42 Content-Disposition: attachment; filename="test.svg" |
rlm@78 | 43 |
rlm@78 | 44 $attach1 |
rlm@78 | 45 |
rlm@78 | 46 $boundary |
rlm@78 | 47 Content-Type: application/octet-stream; name="huh.txt" |
rlm@78 | 48 Content-Transfer-Encoding: base64 |
rlm@78 | 49 Content-Disposition: attachment; filename="huh.txt" |
rlm@78 | 50 |
rlm@78 | 51 $attach2 |
rlm@78 | 52 $boundary-- |
rlm@78 | 53 |
rlm@78 | 54 END_OF_BODY |
rlm@78 | 55 |
rlm@78 | 56 sendmail(%mail) || print "Error: $Mail::Sendmail::error\n"; |