Method 1 - Perl Script with attachment
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #!/usr/bin/perl use MIME::Lite; $to = 'test_1@mail.de;test_2@mail.de'; $from = 'test_3@mail.de'; $subject = 'Test_Mail'; $message = 'Hello this is a test mail best regards me '; $msg = MIME::Lite->new( From => $from, To => $to, Cc => $cc, Subject => $subject, Type => 'multipart/mixed' ); # Add your text message. $msg->attach(Type => 'text', Data => $message ); # Specify your file as attachement. $msg->attach(Type => " application/msexcel ", Path => '/home/test_user/excel_filename.xls', Filename => 'excel_filename.xls', Disposition => 'attachment' ); $msg->send; print "Email Sent Successfully\n"; |
Method 2 - From Command Line
echo Hello, whats up | mail -s "Request" "test@mail.de"
Method 2a - From Command Line with attachment
mail -s "Test" test@mail.de < /var/log/messages
Method 3 - From Command Line with attachment
1 | echo "Test: OK" | mutt -a "error.txt" "calc.txt" -s "Subject: OK!" -- test.me@mail.de |
Keine Kommentare:
Kommentar veröffentlichen