Ianaldo
asked on
Multi-Attachment in cfmail??
Does anyone know how to attach more than one file with cfmail's mimeattach tag or any other method, for example i need to attch file1.doc, file2.swf and file3.pdf to the email, how do i do this??
Thanks for your help,
Ian.
Thanks for your help,
Ian.
Use the <cfmailparam> tag to attach as many files as you like. Alternatively, you could do some file-zipping on the fly and attach the zip file to the email.
ASKER
How do you get the files to atach to a zip??
Could you give me an example of some code you have?
Thanks,
Ian.
Could you give me an example of some code you have?
Thanks,
Ian.
ASKER
Could you send me some code demonstraing how to use the cfparam tage to add multiple attachments though??
Thanks!
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hey jeff, ok you've got the points, just one question though, im trying to implement the zip thing, but i dont really understand it, could you show me what you did, as in post the code you used and how you called it.
Thanks for your help,
Ian.
Thanks for your help,
Ian.
Well, make sure that all the files you want to zip are isolated to a directory of their own. Assuming everything is in C:/Inetpub/wwwroot/zip/ and you want the zip file placed in C:/Inetpub/wwwroot/, simply call the ZipFileNew() function like so:
<cfscript>
ZipFileNew(
'C:/Inetpub/wwwroot/attach ment.zip'
, 'C:/Inetpub/wwwroot/zip/'
);
</cfscript>
Then, simply attach attachment.zip to your email.
<cfscript>
ZipFileNew(
'C:/Inetpub/wwwroot/attach
, 'C:/Inetpub/wwwroot/zip/'
);
</cfscript>
Then, simply attach attachment.zip to your email.
ASKER
Well you see im not actually zipping a folder im zipping 2 files generated on the fly and they are saved to the server, the the zip thing picks them up and zips them, where do i state in the file i just need to send two files zipped:
'C:/Inetpub/wwwroot/zip/fi le.pdf'
And
'C:/Inetpub/wwwroot/zip/fi le2.swf'
I need to send these 2 files
Thanks again for your help!!
'C:/Inetpub/wwwroot/zip/fi
And
'C:/Inetpub/wwwroot/zip/fi
I need to send these 2 files
Thanks again for your help!!
By telling it to zip C:/Inetpub/wwwroot/zip/ it knows to put those two files in the zip file. The catch is that you can only have those two files in that folder because it'll place everything in that folder in the zip file.
ASKER
Yeah you see thats the thing, i have a website that creates lots of files, and people will always be creating these files on the fly so there could well be more than one person creating these files to that folder, so possibly ill need some way that it can dynamically create a folder and then puts the files in the folder, i can do that easily, its just the creating the folder bit dynamically, then i can zip that folder, any ideas???
Cheers!
Cheers!
Yeah, create a folder using CreateUUID() for the name:
<cfscript>
foldername = CreateUUID();
</script>
<cfdirectory action="create" directory="C:/Inetpub/woor ot/zip/#fo ldername#/ ">
<cfscript>
ZipFileNew(
'C:/Inetpub/wwwroot/attach ment.zip'
, 'C:/Inetpub/wwwroot/zip/' & foldername & '/'
);
</cfscript>
<cfscript>
foldername = CreateUUID();
</script>
<cfdirectory action="create" directory="C:/Inetpub/woor
<cfscript>
ZipFileNew(
'C:/Inetpub/wwwroot/attach
, 'C:/Inetpub/wwwroot/zip/' & foldername & '/'
);
</cfscript>
ASKER
Ah rite, ill try that out later,jeff thanks again for all your help!! Much appreciated!!
Ian
Ian