The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> ColdFusion Development
|
Cfmail sending blank emails
Discuss Cfmail sending blank emails in the ColdFusion Development forum on Dev Shed. Cfmail sending blank emails ColdFusion Development forum discussing CFML coding practices, tips on CFML, and other CFML related topics. Find out why ColdFusion is the tool of choice for many e-commerce developers.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

October 3rd, 2011, 05:03 PM
|
 |
We're trapped inside a game!
|
|
Join Date: Jul 2008
Location: Maryland
|
|
|
Cfmail sending blank emails
Again, because I'm still learning Coldfusion, I may be missing something but when I use the cfmail tag to send an email and use the cfmailpart tag, the message of the email is blank. The subject, from and to lines are filled in, just not the body.
Here's the code that I've tried:
PHP Code:
<cfmail to="myemail@host.com" from="test@sample.com" subject="TEST - Resetting your password.">
<cfmailpart type="text/html"><cfoutput>test</cfoutput></cfmailpart>
<cfmailpart type="text/plain"><cfoutput>test</cfoutput></cfmailpart>
</cfmail>
and
PHP Code:
<cfmail to="myemail@host.com" from="test@sample.com" subject="TEST - Resetting your password.">
test
<cfmailpart type="text/html"><cfoutput>test</cfoutput></cfmailpart>
</cfmail>
Both of those attempts have blank messages. This sends an email with "test" in the body:
PHP Code:
<cfmail to="myemail@host.com" from="test@sample.com" subject="TEST - Resetting your password.">
test
</cfmail>
We're using CF9 and I looked at the documentation to make sure that the tags were up to date, as we were on CF 8 until recently. It looks okay to me, but am I missing something that would be causing the blank message?
Thanks!
__________________
"Those who can make you believe absurdities can make you commit atrocities."
|

October 4th, 2011, 03:48 PM
|
|
Moderator
|
|
Join Date: Jun 2002
Location: Raleigh, NC
|
|
Try something like this:
Code:
<cfmail from="yourFrom" to="yourTo" subject="yourSubject">
<cfmailpart type="plain">
Plain text
</cfmailpart>
<cfmailpart type="html">
<cfoutput>
<h1>HTML</h1>
</cfoutput>
</cfmailpart>
</cfmail>
|

October 4th, 2011, 06:37 PM
|
|
Contributing User
|
|
Join Date: May 2008
Posts: 117
Time spent in forums: 17 h 16 m 2 sec
Reputation Power: 6
|
|
Quote: | Originally Posted by Jyncka <cfmailpart type="text/html"><cfoutput>test</cfoutput></cfmailpart> |
Since you mentioned being new to CF, a few tips about <cfoutput>
1) cfoutput tags are only needed when outputting a CF variable, not plain text.
2) Even so, they are never needed when the variable is inside a CF tag like cfmailparam, cfquery, etcetera as they are automatically evaluated (see example below)
So you can safely omit the cfoutput tags from your example.
Code:
<!--- notice it works without using cfoutput --->
<cfset htmlValue = "<h1>Header in HTML</h1>">
<cfmail to="blah@blah.com" from="blah@blah.com" subject="test">
<cfmailpart type="plain">Plain text</cfmailpart>
<cfmailpart type="html">#htmlValue#</cfmailpart>
</cfmail>
|

October 5th, 2011, 08:26 AM
|
 |
We're trapped inside a game!
|
|
Join Date: Jul 2008
Location: Maryland
|
|
|
That didn't work either, I think it might be the environment we run CF on which is jetty. Jetty is different enough from JRun that maybe it gets to the cfmailpart tag and errors or ignores it...I'm not sure. I'll be looking more into it, once I know more about how CF and it's JVM work together and then read up on Jetty, as that aspect of the language is still an enigma to me.
Thank you for the suggestion, Kiteless. For the moment I've taken out the cfmailpart tags so that emails can be received.
|

October 5th, 2011, 09:26 AM
|
|
Contributing User
|
|
Join Date: May 2008
Posts: 117
Time spent in forums: 17 h 16 m 2 sec
Reputation Power: 6
|
|
|
What CF engine are you using and what do you mean by "did not work", you are still receiving an email with no body?
|

October 7th, 2011, 11:28 AM
|
 |
We're trapped inside a game!
|
|
Join Date: Jul 2008
Location: Maryland
|
|
|
Yeah, still sending out blank emails when I use the <cfmailpart> tag. We run CF 9 on Jetty and I think that one of those is causing the problem, but this is a lower priority issue so I haven't had time to go and pinpoint it more. It seems more likely that Jetty would be the culprit since I haven't seen a lot of results on Google saying CF 9 has a problem with this particular tag. I know that there's a way to have it output errors, I guess that would be the next logical step.
Thank you for the advice too, cfSearching. <cfoutput> sometimes confuses me as far as where you need it, but having that straightened out will make my life a little easier.
Like I said, I have a temporary work around until I can get into it further and see what exactly is breaking, so this thread can be considered solved in the interest of helping other people. If anyone has come across this using the setup we are using, or has any ideas, I'd appreciate hearing them for when I have the time to look.
Thanks for the help!
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|