Hent dette lib:
http://swiftmailer.org/downloadog test denne kode:
<?php
if(isset($_POST['send'])){
require_once 'lib/swift_required.php';
$transport = Swift_MailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($transport);
//Create the message
$message = Swift_Message::newInstance()
//Give the message a subject
->setSubject('Min vedhæftning')
//Set the From address with an associative array
->setFrom(array('jdo@example.com' => 'John Doe'))
//Set the To addresses with an associative array
->setTo(array($_POST['mail']))
//Give it a body
->setBody('Her er din fil!')
//And optionally an alternative body
->addPart('<q>Her er din fil!</q>', 'text/html')
//Optionally add any attachments
->attach(Swift_Attachment::fromPath($_FILES['file']['tmp_name'])->setFilename($_FILES['file']['name']));
;
//Send the message
$result = $mailer->send($message);
}
?>
<html>
<head>
<title>Mail Upload</title>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data">
Email: <input type="text" name="mail" /><br />
File: <input type="file" name="file" /><br />
<input type="submit" value="Send" name="send" />
</form>
</body>
</html>
PS: Den er ikke sikker, så den kan misbruges, men koden virker på min server. :o)