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