abracad wrote:
I'd like to add a form that will email a file attachment to me.
Can anyone recommend a decent free script?
Here's a stripped down version of what I've been using
<?php
$headers='';
if(isset($_POST['email'])){
$headers.='From: '.$_POST['email']."\r\n".
'X-from: '.$_POST['email']."\r\n".
'ReturnPath: '.$_POST['email']."\r\n";
}
$message='The following message contains a file'.
'attachment that was posted via a form.';
$subject='Posted attachment';
$e******************@example.com;
if(isset($_POST['email']))
$email_from=$_POST['email'];
else
$e***************@example.com';
// this file is available at:
//
http://www.phpclasses.org/browse/package/32.html
include 'class.html.mime.mail.class';
$mail=new html_mime_mail();
$mail->set_body($message);
if(isset($_FILES['attachment']) && $_FILES['attachment']['error']==0){
$file=$mail->get_file($_FILES['attachment']['tmp_name']);
$mail->add_attachment($file,$_FILES['attachment']['name']);
}
$mail->build_message();
$result=$mail->send('',$email_to,'',$email_from,$subject);
?>
--
Justin Koivisto -
sp**@koivi.com http://www.koivi.com