I am trying to generate an excel report using ColdFusion 2018 and in the excel file there is a column for email id. Instead of showing email id, it shows "[email protected]" as hyperlinked text. And if i click on the text is says "Cannot open the specified file". Is there a setting where i can see the actual email id.
This is happening only in coldfusion 2018, i was not facing this in earlier version. If i generate a web report (Showing html report in table on the screen) using ColdFusion 2018, it works fine. I presume this can be resolved by some security setting and not through code as code is the same for older versions.
Please find the attached screenshot, coldfusion code to generate the excel (removed unncessary code and kept only the necessary sections), excel spreadsheet generated.
Could someone help me with this. I have been searching for the answer in internet and i couldn't find a single thread for this.
What happens if you click on the "Enable Editing" button in the yellow "PROTECTED VIEW" bar at the top of the screen?
Dave Watts, Eidolon LLC
Appreciate your reply Dave. I updated the screenshot now. It just enables editing the spreadsheet, the end result is the same. This is the hyperlink on the text "..\..\..\cdn-cgi\l\email-protection" if this will help.
Hi Dave, I found that this is an email address obfuscation done at Cloudflare. Thanks.
I'm glad that you found the source of your frustration. So, what to do about it? I'm curious as to how this will be resolved.
BTW, I am not totally familiar with Adobe policy, but I believe using an email address as your moniker is against policy. Privacy concerns, and all that. Makes your email address super vulnerable to SPAMbots.
^ _ ^
I have used the the below line of code (found solution from below stackoverflow page). This works fine only for the inner variable #email#, but i have an href tag where this doesn't work because I am not sure how to put email_off tag within href. As a result email id shows correctly for the user but the link will still give the same old issue (throws error as file not specified).
Can you throw some light on how to fix this when i have a mailto link. If i display email directly without href it works fine.
I found this where we need to write code but no information on how to do this in coldfusion. Please help
Hmm. It seems you're doing what you should, and I can confirm doing the same and it does work for me. Let me give more background for any interested to hear it.
You say, "i have an href tag where this doesn't work because I am not sure how to put email_off tag within href". To be clear, you should NOT have to "put email_off tag within href". I say this based on the docs and based on my own experience.
First, per the Cloudflare docs (https://support.cloudflare.com/hc/en-us/articles/200170016-What-is-Email-Address-Obfuscation-), it says that "To prevent unexpected website behavior, email addresses are not obfuscated when they appear in:" and the first thing they list is "Any HTML tag attribute, except for the href attribute of the a tag", and then they list other cases. So you see, you should NOT have to put their special "off" tag "within the href".
Second, I can confirm that things DO work as they say, for me. I have Cloudflare fronting my own sites (such as carehart.org, cf411.com, etc.) And you can see that this is indeed working fine on this page, https://www.cf411.com/cfhelp. See the link within the item discussing "Adobe's free Adobe CF installation support address, firstname.lastname@example.org".
In my html, that appears as this:
Adobe's free Adobe CF installation support address, <a href="mailto:email@example.com"><!--email_off-->firstname.lastname@example.org<!--/email_off--></a>
Notice how I only have that cloudflare off tag BETWEEN the a tags, not WITHIN the href attribute. And the link DOES work if you click it (or merely mouse over it).
So I hear you: you say "this doesn't work". Help us out: what's "not working". Do you mean that somehow when you view the result in Excel you still see it indicating "protected"? Or something else?
What if you just output the result (of your html) to the browser, instead? When you mouse over your href with the mailto link, are you saying you don't see the email address? You really should, from the docs and from my experience. It would help to hear if you do or do not. That may tell where any "problem" is being introduced.
As for the last point, about seeing that "we need to write code but no information on how to do this in coldfusion", I'll clarify for folks following along that this referring to another comment in that SO answer pointed to, where someone pointed out variants of code in different langauges to parse the cloudflare-encoded address. It's here: https://stackoverflow.com/a/58809612. And while there are several language variants shown, CFML is not. And while someone may want to take it on, in this case it really seems that should not be needed, at least in this case.
So in conclusion, you ask if we can "throw some light on how to fix this when i have a mailto link", but again you seem to be doing what you should. If you can share some more info on what's not working (now that you've realized it's a cloudflare issue with that solution), perhaps we can help you get to a solution.
In the code i added email off as you see below. I am not adding anything in mailto as you suggested.
When you move the mouse over the output generated in excel, it shows as below.
When you click on the email id, this is what it shows
Here email id is displaying because of email off tag and the href doesn't work because we don't know how to incorporate email off in href tag. This is what i was referring to. If i generate the output in web it doesn't give an issue. Also i don't need email off tag for generating report on the web interface. Only when i generate report in excel i have to use the email off. Hope this helps.
In my code it generates email id dynamically. I have hardcoded the email id in mailto and tried. It gives the same error.
Just curious.. what happens if you place the email off code around the entire anchor tag?
^ _ ^
Thanks for your comment. Yes, it works that way. I finally found this solution after couple of trial and error.
Glad to hear it. If you could mark either my question or your response as the correct one. I'm sure some user down the road might run into the same issue.
^ _ ^
It is indeed odd that that would be the answer, when it goes against the very cloudflare docs on the mechanism. It also doesn't seem to explain why it would only be an issue for when one is sending html as a table to be rendered as a spreadsheet via Excel, as the OP was doing.
But yep, hey, if it works, it's very good news and to be shared. Thanks, w.