hiermal ein auszug aus meinen quellen.
Mime-Lite ist echt einfach
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
package Sources::Mime;
use strict;
use warnings;
use MIME::Lite;
use Sources::Vars;
use Sources::Mail;
use vars qw(@ISA);
@ISA = qw( MIME::Lite );
sub as_smtpstring
{
my ($self) = @_;
my $buf = [];
my $io = (wrap MIME::Lite::IO_ScalarArray $buf);
$self->replace('Message-ID' => Sources::Mail::build_message_id($self->get('From')));
$self->replace('X-Mailer' => Sources::Vars::X_MAILER);
$self->attr('MIME-Version' => '1.0');
### Create a safe head:
my @fields = grep { $_->[0] ne 'bcc' } @{$self->fields};
my $header = $self->fields_as_string(\@fields);
$io->print($header, "\n");
$self->print_body($io);
join '', @$buf;
}
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
my $msg = Sources::Mime->build(
From => $mime_from,
To => $mime_to,
Cc => $mime_cc,
Bcc => $mime_bcc,
Subject => $subject,
Type => "$type; charset=\"$charset\"",
Encoding => 'quoted-printable',
Data => $text);
my $mime_types = Sources::Global::load_inifile('./mime.types');
foreach my $fileattach (@attachs)
{
my $nname = Sources::Global::get_filename($fileattach);
$nname =~ s!-....$!!;
my $ext = lc(Sources::Global::get_fileextension($nname));
my $type = $mime_types->{$ext} || 'Unknown';
$msg->attach(
Type => $type,
Path => $fileattach,
Filename => $nname,
Disposition => 'attachment');
}
btw. ich hatte mich doch nicht über MIME::Lite geärgert. es war MIME::Parser :)\n\n
<!--EDIT|esskar|1092074257-->