use MIME::Lite; my $msg = MIME::Lite->new( From => $p->{from}, Subject => $p->{subject}, To => $p->{to}, CC => $p->{cc}, BCC => $p->{bcc}, Type => 'multipart/mixed' ); $msg->attach( Type => 'text/plain', Data => $text_mail, Encoding => 'quoted-printable' ); $msg->attach( Type => 'application/pdf', Data => $pdf, Filename => q(buchung_).$token.q(.pdf), Disposition => 'attachment' ); $msg->send || print "you DON'T have mail!";