Re: Email an attached file

From: Date: Wed, 28 May 2003 19:45:47 +0000
Subject: Re: Email an attached file
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-28134@lists.php.net to get a copy of this message
Then you should be able to use that function... So are you storing the "Path" of the file in MYSQL or any other database?!?!!? If not then replace /-----
$file2 = ("./images/$data->name");
//------ to reflect your path... Dan On Wednesday, May 28, 2003, at 02:34 PM, mosypian@savingforcollege.com wrote:
I am storing the file on my server. -----Original Message----- From: Dan Brunner [mailto:daniel.brunner@duni.com] Sent: Wednesday, May 28, 2003 2:42 PM To: mosypian@savingforcollege.com Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Email an attached file Hello!! If your storing the file name, file type, in mysql; and are storing the files on a server. (Which you should be doing!!!) You could use this!! //------------------------------------ $query = "SELECT * FROM Images WHERE Num = $num"; $result = mysql_query ($query, $db); $data = mysql_fetch_object($result); function sendfile($to, $subject, $text, $cc, $from, $file, $type) { $content = fread(fopen($file,"r"),filesize($file)); $content = chunk_split(base64_encode($content)); $uid = strtoupper(md5(uniqid(time()))); $name = basename($file); $text = stripslashes($text); $subject = stripslashes($subject); $header = "From: $from\nReply-To: $from\n"; $header .= "Cc: $cc\n"; $header .= "MIME-Version: 1.0\n"; $header .= "Content-Type: multipart/mixed; boundary=$uid\n"; $header .= "--$uid\n"; $header .= "Content-Type: text/plain\n"; $header .= "Content-Transfer-Encoding: 8bnoit\n\n"; $header .= "$text\n"; $header .= "\n"; $header .= "\n"; $header .= "--$uid\n"; $header .= "Content-Type: $type; name=\"$name\"\n"; $header .= "Content-Transfer-Encoding: base64\n"; $header .= "Content-Disposition: attachment; filename=\"$name\"\n\n"; $header .= "$content\n"; $header .= "--$uid--"; mail($to, $subject, "", $header); } $file2 = ("./images/$data->name"); $type = ("$data->filetype"); $mess .= ("\n"); $mess .= ("\n"); $mess .= ("\n"); $mess .= ("\n"); $mess .= ("Here is that Pic you wanted..."); sendfile($To, $sub, $mess, $cc, $From, $file2, $type); //----------------- Of course all of the $To,$sub,etc...etc...etc...are from posting the data from a form. I think you can figure out the rest.... Good luck!! Dan Brunner On Wednesday, May 28, 2003, at 01:12 PM, jeffrey_n_Dyke@Keane.com wrote:
www.phpclasses.org is your best bet. there are plenty. personally i use this one..http://phpclasses.com/browse.html/package/32.html check out his site for examples. hth jd
                    "Marie Osypian"
                    <mosypian@savingforco       To:
<php-db@lists.php.net>
                    llege.com>                  cc:
                                                Subject:     [PHP-DB]
Email an attached file
                    05/28/2003 02:08 PM
I am using something like this example code below to send e-mail and wondered if anyone could tell me how I could include a file also in this email if possible. Thanks in advance. Marie EXAMPLE: $myname = "Me Myself"; $myemail = "myself@email.com"; $contactname = "Mister Contact"; $contactemail = "contact@email.com"; $message = "hello from happy me"; $subject = "Included your file"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: ".$myname." <".$myemail.">\r\n"; $headers .= "To: ".$contactname." <".$contactemail.">\r\n"; $headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n"; $headers .= "X-Priority: 1\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; $headers .= "X-Mailer: Just My Server"; mail($contactemail, $subject, $message, $headers); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.db (#28134) next »