• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFMAILPARAM and Sandbox Security

New Here ,
Jul 18, 2011 Jul 18, 2011

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

TOPICS
Advanced techniques

Views

1.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 20, 2011 Jul 20, 2011

Copy link to clipboard

Copied

~Bump~

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jul 20, 2011 Jul 20, 2011

Copy link to clipboard

Copied

What do you mean it "doesn't work"?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 20, 2011 Jul 20, 2011

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jul 20, 2011 Jul 20, 2011

Copy link to clipboard

Copied

Does this clarify?

Not particularly. What was the permissions error you received?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 20, 2011 Jul 20, 2011

Copy link to clipboard

Copied

It was simply the access denied message (java.io permission)...kind of generic.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jul 20, 2011 Jul 20, 2011

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 20, 2011 Jul 20, 2011

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 20, 2011 Jul 20, 2011

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jul 20, 2011 Jul 20, 2011

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 21, 2011 Jul 21, 2011

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 21, 2011 Jul 21, 2011

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)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jul 21, 2011 Jul 21, 2011

Copy link to clipboard

Copied

Try putting in the fully qualified path to the file rather than a relative path.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 21, 2011 Jul 21, 2011

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 25, 2011 Jul 25, 2011

Copy link to clipboard

Copied

Just wondering if anybody else had any advice? If you need to see any code, let me know.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jul 25, 2011 Jul 25, 2011

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 02, 2011 Aug 02, 2011

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation