Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Special Chars in Subject line - cfmail

Status
Not open for further replies.

yippiekyyay

Programmer
Oct 26, 2002
186
CA
Hello everyone,

I can't seem to add special characters to the subject line in a cfmail tag! I'm trying to add "é" and have not had any success. I've tried :
subject="testé"
subject="testé"
subject="test#char(233)#"

No luck so far - any ideas would be appreciated! (I am able to add "é" in the content of the email?!?)

-Sean
 
Hi

try this (a friend hooked me up with the answer :)

First set the string as a local variable...
<cfset Subject ="test" & chr(233)>

and then use that in your <CFMAIL>...

<cfmail to="foo@foo.com" from="foo@foo.com"subject="#Variables.Subject#">
test
</cfmail>

Hope that helps!!

RR [yinyang]
 
Thanks for answering rockyroad, unfortunately I still get the same result. I should have mentioned earlier that I can have special characters in the content of my emails - just not in the subject line!

Were you able to test this out at all? Did it work for you?

Thanks again rockyroad!

-Sean
 
Is it possibly the mail client? What are you using as a mail client?

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Great idea webmigit! Just as I was reading your post I remembered a somewhat similar situation a couple of years ago (the content of the email couldn't handle special chars - but because that was the email server on their end, I just forgot about it!)

A seperate group handles our email server - I'll email them the question and let you all know what they say!

Thanks!

-Sean
 
When I tested my solution, it worked AOK. Hope you have had success.

RR
 
Thanks for testing rockyroad! At least we know for sure now that it's not the code.

I haven't forgotten to report back to this thread - I just haven't gotten an answer yet! I'll write back when they get back to me.

-Sean
 
I've recieved some emails recently with things such as &gt; in the subject line...

So.. just now, I sent myself an email with é in the subject line (through OE), it came in, and the é displayed properly.. I hit forward so it would put all the info in the message body thus letting me see the html.. And it wasn't eacute; or anything.. it was just é in the html source.

I also tried this with Plain Text instead of RTF.. same exact result..

I have a contact page on my site with a form utilizing cfmail.. and so I tried it through taht and it worked.

I have three questions:

1.) Can I have your email address.. If you're not willing to share it on the forums, email it to support@alfii.com and I'll write a script on my server.

2.) In my cfmail, type is set to nothing.. there's no type attribute, do you have one in yours?

3.) What version of Cold Fusion do you have.

Tony

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Hi,

The code exactly as I have posted is what worked. There was no TYPE attribute set. The testing was done on ColdFusion 5. Hope that helps.

RR
 
RockyRoad,

What we're trying to conclude is whether its a bug in his CF, a bug in his OE or just a lack of feature for either..

Your code works as well as mine as well as anyone's, its just not working for him.

On top of that, CFMAIL has never been a favorite tag of developers, seems mx works better with it, but its still a hassle.

Tony

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Sorry, I didn't realize whom your previous post was addressed to. I see now that you were asking the question of yippiekyyay, not me. I understand the problem, just was answering when the question was not meant for me...sorry for the confusion.
 
Not a problem, just wish they'd respond..

I'm thinking it is his mail client.. it doesn't SEEM there is a way Cold Fusion can screw this up.

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Hi again,

just an update - we are apparantally in the process of switching between CF5 and MX, so they asked me if they could look into this later (which I figure is a good idea in case the problem goes away after).

At any rate, I'm now pretty sure that you are right about it being the email client because I've sent test messages to non-internal places and it's been working fine - only my colleagues and I get the special characters replaced.

Anyways - I'll email you in a momment webmigit. Thanks to you both for helping me with this!

-Sean

 
Hello again everyone,

The problem has been solved - only, I do not have the solution! One day, it just started working. I asked our helpdesk about it to see if they could track down what was changed (so that we would know in case it ever happens again). Here is an except from the response:
"According to our webmaster, this is due to an encoding type error when the characters are encoded by ColdFusion then decoded by Outlook. To avoid this problem, use the following string:
url encoded format (enter text)
Outlook will then recognize the coded text as HTML and decode it accordingly."

I wasn't too clear about the answer (i.e. how to use that string), so I wrote again for clarification but have not yet heard back from them. My CFMAIL tag does have the type specified (<cfmail from="sender@sender.com" to="name@name.com" subject="testé" type="HTML">) which is what I thought was there to handle such encoding problems (I guess I was wrong - but I would like to know!).

Anyways, I'll repost if I ever get a definite answer.

Cheers,
-Sean
 
Hmm...interesting. I never would have thought of that.

To use the UrlEncodedFormat() function, it would go something like this:
Code:
<cfmail from="sender@sender.com" 
        to="name@name.com" 
        subject="#UrlEncodedFormat(testé)#" 
        type="HTML">
I don't know if that will work, I've never bothered encoding a subject line. Like you, I thought CF would handle this on it's own.



Hope This Helps!

Ecobb

&quot;My work is a game, a very serious game.&quot; - M.C. Escher
 
What they're saying is that your cfmail code looks like this..

Code:
<cfmail to="..." from="..." type="html" [b]subject="#[i]urlencodedformat[/i]("testé")#"[/b]>

When apparently it does not.. since the subject has the word test in it, I'm assuming this is not a live cfmail... check one of the live cfmails and see if it is said like that.

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Well, if I use the code as Ecobb sugested, I get the following error:
Code:
Just in time compilation error

Invalid token found on line 8 at position 35. ColdFusion was looking at the following text:
é 
Invalid expression element. The usual cause of this error is a misspelling in the expression text.

ColdFusion will accept it if I add single or double quotes as Webmigit had it (and yes, I did verify that I didn't have that code anywhere), but the result is the following subject line:
test%E9%20test%26eacute%3B

I can see what it's doing (I recognize the %20 for space), but I can only guess at why it's not working. My first impression is that my email would have no way of knowing that the text has been encoded (maybe I want to send "%20"!), so it's left as is....?

Either way, it's working now if I just enter the text normally and I know who to call if it ever stops working - but an explanation would've been nice!

Thanks again for all your help!
-Sean
 
Yeah, I forgot the quotes in my example. Oops!



Hope This Helps!

Ecobb

&quot;My work is a game, a very serious game.&quot; - M.C. Escher
 
Yeah.. I wasn't saying use urlendcodedformat.. I was saying that they said you're using it.. or something similar.

Glad it works.. don't fix what ain't broke or probe it too much either.

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top