Anon
07-20-2000, 12:11 PM
Hi,
Does anyone can teach me how to attach file in the mail functing using php?
thx a lot
Does anyone can teach me how to attach file in the mail functing using php?
thx a lot
|
Click to See Complete Forum and Search --> : attachment in the mail Anon 07-20-2000, 12:11 PM Hi, Does anyone can teach me how to attach file in the mail functing using php? thx a lot Anon 07-21-2000, 11:23 AM accord to: http://renoir.vill.edu/~ylee/mailfile.html I'd rewrite it easily <head> <title>PHPMail</title> <meta http-equiv="Content-Type" content="text/html; charset=big5"> </head> <body bgcolor="#FFFFFF" text="#000000" link="#33CC33" vlink="#33CC33" alink="#33CC33"> <?php echo "File name=".$filename_name."<BR>\n"; echo "File size=".$filename_size." bytes<BR>\n"; echo "File type=".$filename_type."<BR>\n"; if (is_readable($filename)) { $fd = fopen($filename, "r"); $contents = fread($fd, filesize($filename)); $stmp = $contents; $len = strlen($stmp); $out = ""; while ($len > 0) { if ($len >= 76) { $out = $out . substr($stmp, 0, 76) . "\r\n"; $stmp = substr($stmp, 76); $len = $len - 76; } else { $out = $out . $stmp . "\r\n"; $stmp = ""; $len = 0; } } $contents = $stmp; fclose($fd); } mail("$to","$subject", " --Attached== Content-Transfer-Encoding: 7bit Content-Type: text/plain $msg"." --Attached== Content-Type: $filename_type; name=\"$filename_name\" Content-Disposition: attachment; filename=\"$filename_name\" Content-Transfer-Encoding: base64 ". $contents ." --Attached==-- " , "From: ${from} Reply-To: ${from} X-Mailer: PHP_VAT Content-Type: multipart/mixed; boundary=Attached== "); ?> Mail SENT successfully!! </body> for attach detail, I would suggest you try to view a source mail in Linux, that would tell you a lot secrets!! Anon 08-24-2000, 12:44 PM if you want the vega's code is ok, you must encode in base64 the content of $contents variable by use base64_encode($contents); in the body string of the message. and all is ok :) Anon 08-25-2000, 12:22 AM I'd tested. it's ok. but..... attached file upper limit to 2M bytes only... send a attached mail to your friend by PHP? Try my settings... :) Anon 09-07-2000, 01:49 AM As i also have same problem for attachment of file in mail, i read your suggestion. But i want to know , before reading file by function is_readable($filename) , we have to upload that file to server? because is_readable($filename) return false when i used your code to attach my file from local directory. Pl. reply. Thanks Palak Anon 09-07-2000, 04:36 AM send your code to me.... I need more information... Anon 11-07-2000, 11:08 AM Hi there! I'm a beginner and I tried to use your code, but it didn't work. Can you explain step-by-step PLEAAAAASE what I have to do? Sorry if it takes a long time, remind that beginners need a long time to understand!!! ;-)) Thank you so much for your help! Manuela acidbox 08-16-2002, 04:10 PM has there been any progress on this script? I would like to get it to work as well. PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved. |