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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFMail issue

Status
Not open for further replies.

jimmyshoes

Programmer
Jun 1, 2008
132
0
0
GB
I am experimenting with cfmail.

I want to send an email in plain text format, however if I change the cfmail type attribute to "text" my email is still sent in HTML format

What am I doing wrong

Code:
		<cfsavecontent variable="varContentTextEv">
			<cfoutput>
			Some Text
			</cfoutput> 
		</cfsavecontent>

		<cfsavecontent variable="varContentHTMLEv">
			<cfoutput>
			Some HTML
			</cfoutput> 
		</cfsavecontent>
		
		<!--- Send the email --->
		
		<cfmail to="recip@mail.com"
				from="sender@mail.com"
				subject="Your Email"
				timeout="300"
				type="text">
	
			<cfmailpart type="text" wraptext="74">
				#varContentTextEv#
			</cfmailpart>
	
			<cfmailpart type="html" wraptext="74">
				#varContentHTMLEv#
			</cfmailpart>
	
		</cfmail>

I have also noticed that If i do not wrap my text in cfoutput tags within cfsavecontent then my emails are empty. Why is this?
 
I think the cfmailpart tags are overriding the type attribute that you have set to "text". You could try setting it to "plain", but I think what you'll have to do is put a cfif around the cfmailpart that renders the HTML content so it doesn't get called in specific situations where you want to send plain text only.

Regarding having to use cfoutput in the cfsavecontent tags, are you sure that code you pasted isn't between cfsetting enablecfoutputonly="yes" tags?

-Tek
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top