4 Einträge, 1 Seite |
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
#!/usr/bin/perl use Mail::Sender::Easy qw(email); $mailserver = "..."; $mail_subject = "Testmail"; $mail_message = "..."; ... email({ 'from' => 'test@test.com', 'to' => 'test@test.com', 'subject' => $mail_subject, 'smtp' => $mailserver, '_text' => 'Sorry, your e-mail client is not supporting html mails.', '_html' => $mail_message, '_attachments' => { #for(my $i = 1; $i <= 10; $i++) #{ #$imgfiles[$i] => {'_disptype'=>'GIF Image','_inline'=>$imgfiles[$i],'description'=>'ATM-Image','ctype'=>'image/gif','file'=>$imgdirfiles,}, #} #for 'file1.png' => {'_disptype'=>'GIF Image','_inline'=>'file1.png','description'=>'ATM-Image','ctype'=>'image/png','file'=>'file1.png',}, 'file2.png' => {'_disptype'=>'GIF Image','_inline'=>'statsimg2','description'=>'ATM-Image','ctype'=>'image/gif','file'=>'file2.png',}, }, }) or die "email() failed: $@";
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[...]
my %attachments;
for (@imgfiles) {
$attachments{$_} = {
_disptype => 'GIF Image',
_inline => $_,
description => 'ATM-Image',
ctype => 'image/gif',
file => $imgdirfiles
};
}
email({
from => 'alice@example.com',
to => 'bob@example.com',
[...]
_attachments => \%attachments
}) or die "sending mail failed: $@";
[...]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
my $attac = {};
for(my $i = 1; $i <= 10; $i++) {
$attac->{ $imgfiles[$i] } = {'_disptype'=>'GIF Image','_inline'=>$imgfiles[$i],'description'=>'ATM-Image','ctype'=>'image/gif','file'=>$imgdirfiles,},
} #for
email({
'from' => 'test@test.com',
'to' => 'test@test.com',
'subject' => $mail_subject,
'smtp' => $mailserver,
'_text' => 'Sorry, your e-mail client is not supporting html mails.',
'_html' => $mail_message,
'_attachments' => $attac,
}) or die "email() failed: $@";
4 Einträge, 1 Seite |