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

cfmailparam file argument doesnt work within events

Contributor ,
May 28, 2006 May 28, 2006

Copy link to clipboard

Copied

I wrote a cfc to send emails and it uses cfmailparam to attach an optional image. It worked well so I turned it into an Asynchronous Event so users don't have to wait for it to process all of the emails. Again it worked well until I tried to include an image (which uses cfmailparam of course). A cfdump of #cfcatch# reported:

String index out of range: -1
It points to the line of code that has cfmailparam in it.

What has a string error go to do with reading a file? This code worked perfectly when it wasn't run as an event. I tried replacing a dynamic file name with a hard coded file path but it makes no difference. I also tested cffile and it can read the gif as a binary and write as well.

Is this a bug with cfmailparam running within an event? My code (for the cfmail part) is below:

<CFMAIL query="recipients" to="#email#" from="Messaging <noreply@#request.AppInfo.email_domain#>" subject="#email_title#" replyto="noreply@#request.AppInfo.email_domain#" failto="failedmail@#request.AppInfo.email_domain#">
<CFMAILPART type="html">
<HTML><BODY bgcolor="white">
<CFIF len(sender_logoPath)>
<CFMAILPARAM file="#sender_logoPath#" disposition="inline" contentid="senderlogo">
<IMG src="cid:senderlogo"><BR>
</CFIF>
#ParagraphFormat(newMessage.message_txt)#
</BODY></HTML>
</CFMAILPART>
<CFIF IsDefined("image_url") and len(image_url)>
<CFMAILPARAM file="#request.appInfo.imageattachment_path##image_url#_email.jpg" type="image/jpeg" disposition="attachment">
</CFIF>
</CFMAIL>


Does anyone have an ideas please? To clarify, the code worked with cfmailparam when it was just a regular cfc called from a .cfm page, and as an event gateway it can send emails without attachments okay. The file attachments definately 100% exist. I've been working on this problem for 7 hours now. 😞 Thanks.
Gary.


P.S. Here's the stack trace if it means anything to anyone:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(Unknown Source) at coldfusion.tagext.net.MailParamTag.resolveUrl(MailParamTag.java:204) at coldfusion.tagext.net.MailParamTag.resolveUrl(MailParamTag.java:181) at coldfusion.tagext.net.MailParamTag.setFile(MailParamTag.java:91) at cfcommsEmailer2ecfc1325954500$funcONINCOMINGMESSAGE.runFunction(\\Dcdb01\websites\dev\site2\gateway\commsEmailer.cfc:100) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:348) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:258) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:56) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:211) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:173) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:192) at coldfusion.filter.EventComponentFilter.invoke(EventComponentFilter.java:67) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:203) at coldfusion.filter.EventRequestMonitorFilter.invoke(EventRequestMonitorFilter.java:46) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.eventgateway.EventProxy.invokeComponent(EventProxy.java:52) at coldfusion.eventgateway.EventRequestHandler.invokeCFC(EventRequestHandler.java:165) at coldfusion.eventgateway.EventRequestHandler.processRequest(EventRequestHandler.java:102) at coldfusion.eventgateway.EventRequestDispatcher$Task.run(EventRequestDispatcher.java:121) at coldfusion.util.SimpleWorkerThread.run(SimpleThreadPool.java:214)
TOPICS
Event gateways

Views

3.5K

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

correct answers 1 Correct answer

Contributor , Jun 02, 2006 Jun 02, 2006
Adobe have logged this bug as #63544. The workaround, thanks for CF engineer Jean-Francois Pypops, is to to specify an absolute URL pointing to the file. The documentation doesn't say that a URL can be used but thankfully for this undocumented feature I have a workaround until a fix becomes available.

Votes

Translate

Translate
Community Expert ,
May 29, 2006 May 29, 2006

Copy link to clipboard

Copied

String index out of range: -1
It points to the line of code that has cfmailparam in it.
What has a string error go to do with reading a file?

Indeed. However, I do believe there is a plausible reason for the error message. My hypothesis is that you're using the Developer Edition of MX7.x, which is allowed only one thread for processing Gateway events. I suspect that Coldfusion requires at least 2 threads to send an e-mail containing an attachment. Just a wild guess.

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
Contributor ,
May 29, 2006 May 29, 2006

Copy link to clipboard

Copied

I'm running the full Enterprise edition, it's not dev or eval.

Thanks for your input anyway.
Gary.

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
Community Expert ,
May 29, 2006 May 29, 2006

Copy link to clipboard

Copied

I'm running the full Enterprise edition
It's back to the mill again. I've tested the code with all possible combinations of attributes for cfmailparam, including setting the values in the calling page, changing location, permissions, etc. of the attached file. No luck. Like you, I got the error "String index out of range: -1" every time.

In my opinion, the first five lines of your stack trace suggest Coldfusion is having problems. It appears that the CFML-to-Java conversion of cfmailparam doesn't work within the Gateway framework.

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
Contributor ,
May 30, 2006 May 30, 2006

Copy link to clipboard

Copied

Thanks BKBK. How do you suggest I go about reporting this as a bug to Adobe? Do you have any friends in high places who will listen to you about this bug and help provide a fix?

Anything you can do to help will be appreciated. We're launching a website today that relies on using cfmailparam within an event so this is kind of a showstopper. We've found a lot of them with CF7.

Thanks,
Gary.

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
Community Expert ,
May 30, 2006 May 30, 2006

Copy link to clipboard

Copied

Gary_F,
To report a bug, follow the Send Feedback link at the bottom of this page. As far as Coldfusion is concerned, men don't come in higher places than Mr. Ben Forta (ben@forta.com). Write him.

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
Contributor ,
Jun 02, 2006 Jun 02, 2006

Copy link to clipboard

Copied

Adobe have logged this bug as #63544. The workaround, thanks for CF engineer Jean-Francois Pypops, is to to specify an absolute URL pointing to the file. The documentation doesn't say that a URL can be used but thankfully for this undocumented feature I have a workaround until a fix becomes available.

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
Community Expert ,
Jun 03, 2006 Jun 03, 2006

Copy link to clipboard

Copied

What a relief. It redeems Coldfusion that it is possible to send e-mail attachments via Event Gateways, albeit by means of a workaround.

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
Explorer ,
Oct 12, 2006 Oct 12, 2006

Copy link to clipboard

Copied

Does anyone know if this bug has been resolved in a hot fix or anything. I am looking around on the adobe site for a list of bugs etc and I cannot find it for the life of me.

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
Contributor ,
Oct 12, 2006 Oct 12, 2006

Copy link to clipboard

Copied

A bug list from Adobe? Ha-ha-ha! If they published a bug list then developers won't have to spend days messing around with their own code in the innocent assumption that the problem lies with their code or setup. What fun would it be if we only had to consult a published list of bugs?

I think the answer to your question is no. Anyone wanting a fix to a seldom reported bug must puchase an expensive support contract, otherwise it's tagged on to the end of their private list of bugs to be fixed when they choose to do so.

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
Explorer ,
Oct 20, 2006 Oct 20, 2006

Copy link to clipboard

Copied

Gary, yeah you are right, it would save us to much valuable time!

Ok, but seriously, CF is great when it works.....but when it does not want to cooperate....

I have run into another issue now. I can send a simple html file as an attachment (using abs URL) but if I try to attach more than 1 files it take about 75 minutes to send 300 emails. If I attach a pdf file nothing gets sent. All the messages just sit in the spool.

Has anyone else seen this issue or have any ideas?

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
Explorer ,
Oct 20, 2006 Oct 20, 2006

Copy link to clipboard

Copied

LATEST
Ok here is a little more info I have. I see the following in the mail log.

IOException while sending message; nested exception is: java.net.SocketException: Software caused connection abort: socket write error

and

421 Command timeout, closing transmission channel

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