To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > Misc Help > Windows Help

Windows Help Help with the Windows operating system

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-20-2000, 12:11 PM   #1
Anon
Senior Member
 
Join Date: Jun 2000
Posts: 65,386
attachment in the mail

Hi,
Does anyone can teach me how to attach file in the mail functing using php?
thx a lot
Anon is offline   Reply With Quote
Old 07-21-2000, 11:23 AM   #2
Anon
Senior Member
 
Join Date: Jun 2000
Posts: 65,386
RE: attachment in the mail

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 is offline   Reply With Quote
Old 08-24-2000, 12:44 PM   #3
Anon
Senior Member
 
Join Date: Jun 2000
Posts: 65,386
error

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 is offline   Reply With Quote
Old 08-25-2000, 12:22 AM   #4
Anon
Senior Member
 
Join Date: Jun 2000
Posts: 65,386
RE: attachment in the mail

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 is offline   Reply With Quote
Old 09-07-2000, 01:49 AM   #5
Anon
Senior Member
 
Join Date: Jun 2000
Posts: 65,386
RE: attachment in the mail

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 is offline   Reply With Quote
Old 09-07-2000, 04:36 AM   #6
Anon
Senior Member
 
Join Date: Jun 2000
Posts: 65,386
RE: attachment in the mail

send your code to me....

I need more information...
Anon is offline   Reply With Quote
Old 11-07-2000, 11:08 AM   #7
Anon
Senior Member
 
Join Date: Jun 2000
Posts: 65,386
RE: attachment in the mail

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
Anon is offline   Reply With Quote
Old 08-16-2002, 04:10 PM   #8
acidbox
[]D [] []\/[] []D
 
Join Date: Apr 2002
Posts: 349
has there been any progress on this script? I would like to get it to work as well.
__________________
later,

acid
acidbox is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 01:10 PM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.