Re: [PHP] email attachments and PHP
I was wondering if there is a way to attach files to emails sent via a PHP script. I just checked the 'mail functions' chapter of the php manual, but it doesn't seem to mention attachments. The attached files will come from the same server that php is running on BTW. check my reply and homegrown effort to the Probs with MIME multipart/alternative generated with PEAR mime.php thread a little while back. cheers Henry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] email attachments
use PEAR::Mail(); it has all you need. James E. Hicks III [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... You need a Content-Disposition in yer $mime variable. I'll leave it up to you to figure out where, because I've forgotten where it goes exactly. James -Original Message- From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 16, 2002 8:46 AM To: [EMAIL PROTECTED] Subject: [PHP] email attachments This nifty code (taken from PHP Cookbook) sends an email with a file attached in-line. The text from the attached file appears within the body of the email. I need to send attached files that are not in-line, but, rather, come as attached files that the user views outside of their email browser. Can somebody help me with this. Maybe tweak the code I've got? Thanks! //attachment $to = $the_email; $subject = 'dump'; $message = 'this is the dump'; $email = '[EMAIL PROTECTED]'; $boundary =b . md5(uniqid(time())); $mime = Content-type: multipart/mixed; ; $mime .= boundary = $boundary\r\n\r\n; $mime .= This is a MIME encoded message.\r\n\r\n; //first reg message $mime_message .=--$boundary\r\n; $mime .=Content-type: text/plain\r\n; $mime .=Content-Transfer-Encoding: base64; $mime .=\r\n\r\n . chunk_split(base64_encode($message)) . \r\n; //now attach $filename = mysqldump/surveydump.txt; $attach = chunk_split(base64_encode(implode(, file($filename; $mime .=--$boundary\r\n; $mime .=Content-type: text/plain\r\n; $mime .=Content-Transfer-Encoding: base64; $mime .=\r\n\r\n$attach\r\n; mail($to, $subject, , $mime); //attachment -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] email attachments
You need a Content-Disposition in yer $mime variable. I'll leave it up to you to figure out where, because I've forgotten where it goes exactly. James -Original Message- From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 16, 2002 8:46 AM To: [EMAIL PROTECTED] Subject: [PHP] email attachments This nifty code (taken from PHP Cookbook) sends an email with a file attached in-line. The text from the attached file appears within the body of the email. I need to send attached files that are not in-line, but, rather, come as attached files that the user views outside of their email browser. Can somebody help me with this. Maybe tweak the code I've got? Thanks! //attachment $to = $the_email; $subject = 'dump'; $message = 'this is the dump'; $email = '[EMAIL PROTECTED]'; $boundary =b . md5(uniqid(time())); $mime = Content-type: multipart/mixed; ; $mime .= boundary = $boundary\r\n\r\n; $mime .= This is a MIME encoded message.\r\n\r\n; //first reg message $mime_message .=--$boundary\r\n; $mime .=Content-type: text/plain\r\n; $mime .=Content-Transfer-Encoding: base64; $mime .=\r\n\r\n . chunk_split(base64_encode($message)) . \r\n; //now attach $filename = mysqldump/surveydump.txt; $attach = chunk_split(base64_encode(implode(, file($filename; $mime .=--$boundary\r\n; $mime .=Content-type: text/plain\r\n; $mime .=Content-Transfer-Encoding: base64; $mime .=\r\n\r\n$attach\r\n; mail($to, $subject, , $mime); //attachment -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] email attachments
I wish that made sense to me. Can you expound? James E. Hicks III [EMAIL PROTECTED] 04/16/02 09:41AM You need a Content-Disposition in yer $mime variable. I'll leave it up to you to figure out where, because I've forgotten where it goes exactly. James -Original Message- From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 16, 2002 8:46 AM To: [EMAIL PROTECTED] Subject: [PHP] email attachments This nifty code (taken from PHP Cookbook) sends an email with a file attached in-line. The text from the attached file appears within the body of the email. I need to send attached files that are not in-line, but, rather, come as attached files that the user views outside of their email browser. Can somebody help me with this. Maybe tweak the code I've got? Thanks! //attachment $to = $the_email; $subject = 'dump'; $message = 'this is the dump'; $email = '[EMAIL PROTECTED]'; $boundary =b . md5(uniqid(time())); $mime = Content-type: multipart/mixed; ; $mime .= boundary = $boundary\r\n\r\n; $mime .= This is a MIME encoded message.\r\n\r\n; //first reg message $mime_message .=--$boundary\r\n; $mime .=Content-type: text/plain\r\n; $mime .=Content-Transfer-Encoding: base64; $mime .=\r\n\r\n . chunk_split(base64_encode($message)) . \r\n; //now attach $filename = mysqldump/surveydump.txt; $attach = chunk_split(base64_encode(implode(, file($filename; $mime .=--$boundary\r\n; $mime .=Content-type: text/plain\r\n; $mime .=Content-Transfer-Encoding: base64; $mime .=\r\n\r\n$attach\r\n; mail($to, $subject, , $mime); //attachment -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php