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