Forum Moderators: coopster

Message Too Old, No Replies

attach a zip file to email

how can i attach a zip file and send to user in real time

         

phparion

5:35 pm on Mar 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi,

I have some zip files in a folder online, user can download them but i dont want to give direct links of files to user for downloading, as files are light thats why i want to attach them and send by email,

for example, if a user logs in and click on a link then the script should automatically read the target zip file in the zip files folder and then attach it in email and send to users email.

please help me to solve this problem.

thanks

RonPK

5:51 pm on Mar 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You will first need to encode the zip file for mail transfer:

$encodedZip = chunk_split(base64_encode(file_get_contents("thefile.zip")));

Next, compose the mail with multipart/related and boundary headers. There are several examples in the comments at php.net/mail

HTH