Copy link to clipboard
Copied
I have a form that simply sends out an email with an xls attachment utilizing cfmailparam. I have noticed that if I have sandbox security turned on, that it does not work. So what I did was use gettempdirectory() to get the file location. I then put that into the file/directory tab of the sandbox that houses my website. This did not work. Has anyone else run into this?
Thoughts?
~Clay
Copy link to clipboard
Copied
~Bump~
Copy link to clipboard
Copied
What do you mean it "doesn't work"?
Copy link to clipboard
Copied
My cfmail code worked without the cfmailparam that attached the xls file. If I turned off sandbox security, the attachment worked. So I figured I needed to add the temp directory to the sandbox. I used gettempdirectory() to discover the temp directory. I then added that into the sandbox for the site. This did not solve the problem. The error I am running into is a permissions/security error. I cannot use cfmailparam to attach the file with sandbox security.
Does this clarify?
Copy link to clipboard
Copied
Does this clarify?
Not particularly. What was the permissions error you received?
Copy link to clipboard
Copied
It was simply the access denied message (java.io permission)...kind of generic.
Copy link to clipboard
Copied
But access denied to *where*? What file is it trying to access?
It'll be in the cfcatch struct if you don't have full debugging turned on.
Copy link to clipboard
Copied
I am simply attaching an xls file that is in the same directory as my cf file. It is that file that says it is denied when sandbox security is enabled.
Copy link to clipboard
Copied
Jesus: this is like pulling teeth. Although... slightly less rewarding.
Can you post the exact error message in its entirety. Can you make sure you have robust exception handling on before you do so.
Cheers.
--
Adam
Copy link to clipboard
Copied
Phew, I thought I was going to be the one to have to say it. Luckily Adam sobered up in time
Copy link to clipboard
Copied
Luckily Adam sobered up in time
Heh. I was actually at the pub when I wrote that. Waiting for someone to bring me a pint.
--
Adam
Copy link to clipboard
Copied
Here is the error message...
msg - access denied (java.io.FilePermission formcalculator.xls read)
Type - Security
Stack Trace - java.security.AccessControlException: access denied (java.io.FilePermission formcalculator.xls read) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:374) at java.security.AccessController.checkPermission(AccessController.java:546) at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) at java.lang.SecurityManager.checkRead(SecurityManager.java:871) at java.io.File.isFile(File.java:776) at coldfusion.tagext.net.MailParamTag.setFileHelper(MailParamTag.java:112) at coldfusion.tagext.net.MailParamTag.doStartTag(MailParamTag.java:296) at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2722) at cfformcalculatorprocess2ecfm2145555501._factor7(D:\inetpub\wwwroot\activant\calculator\formcalculatorprocess.cfm:113) at cfformcalculatorprocess2ecfm2145555501.runPage(D:\inetpub\wwwroot\activant\calculator\formcalculatorprocess.cfm:1) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:416) at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:381) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:94) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62) at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:126) at coldfusion.CfmServlet.service(CfmServlet.java:200) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) at jrun.servlet.FilterChain.doFilter(FilterChain.java:86) at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at jrun.servlet.FilterChain.service(FilterChain.java:101) at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106) at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286) at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543) at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203) at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320) at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428) at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266) at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Copy link to clipboard
Copied
Try putting in the fully qualified path to the file rather than a relative path.
Copy link to clipboard
Copied
Thanks for the tip. I tried that (used ExpandPath and GetDirectoryFromPath) and received the same error message. Any other thoughts?
Copy link to clipboard
Copied
Just wondering if anybody else had any advice? If you need to see any code, let me know.
Copy link to clipboard
Copied
If you need to see any code, let me know.
Yes, please post the smallest example that consistently reproduces the issue.
Copy link to clipboard
Copied
By way of follow-up. I (along with our IT staff) figured out the issue. There were actually two errors being thrown (although we did not discover the second until we fixed the first).
The first error was the access denied message from earlier. While I thought permissions for the CF user on the server were set, we discovered that someone had set them to not be inherited to this particular directory (I haven't a clue as to why). Once we adjusted it, all was well.
The second error that we ran into was revealed after the permissions were handled. I was trying to email the xls doc as an attachment and for some reason, it was not finding the cfmailparam attachment. I discovered through trial and error that you have to use the # signs around the value if it is a variable. Once I put those in, it worked.
Thanks everyone for your thoughts and ideas.
~Clay