*** MADE CORRECTIONS TO MY CODE SAMPLE ***

I've been busy all morning and I haven't had time to respond to this.

Most of the time to prevent your email from be caught as SPAM you want 
send either plain text or multi-part Text and HTML.  If you send just as 
HTML that will start to trigger in SPAM filters.

I use this function to create a nicely formated text message from an 
HTML message.  The <cfmailpart> tag will let your create a separate text 
portion.

<cfscript>
   
/*####################################################################################
 

   # 
TextMessage                                                                     
   
#
   # Receive string and return string with any and all tags striped 
out                 #
   # 1. replace <BR> tags with 
CRLF                                                     #
   # 2. Strip all remaining html tags from a string        
                            #
   # 3. return plain text 
message                                                       #
   
####################################################################################*/
 

   function TextMessage(string) {
       pattern = "<br>";
       CRLF = chr(13) & chr(10);
       message = ReplaceNoCase(#string#, #pattern#, #CRLF# , "ALL");
       pattern = "<[^>]*>";
       return REReplaceNoCase(#message#, #pattern#, "" , "ALL");
   }
</cfscript>

<cfmail query="mailinglist" to="#email#" from="#webmaster#" 
subject="#subject#" type="HTML">
<cfmailpart type="text/plain">#TextMessage(content)#</cfmailpart>
#content#
</cfmail>

-- 
Wil Genovese

One man with courage makes a majority.
-Andrew Jackson

A fine is a tax for doing wrong. A tax is a fine for doing well. 



NUGROHO NOTO wrote:
> I am sorry if this is the wrong place to post very basic question like this. 
>
> my script is like this....
> <CFMAIL QUERY="mailinglist" 
> TO="#email#" 
> FROM="#webmaster#" 
> SUBJECT="#subject#">
> <CFMAILPARAM NAME="MIME-Version" VALUE="1.0">
> <CFMAILPARAM NAME="Content-Type" VALUE="text/plain; charset=""utf-8""">
> #content#
> </CFMAIL>
>
> The content of the email is written in database (in html format) because it 
> is used for other purpose, viewed online by customers who want to read it 
> online on our website)
> but when I send email .. and the content is outputing the query of those 
> content.
> the emails I got... is like this. 
> <p></p>This is a sample email<br><br><br>content of the message<br><br>you 
> receive this email<br>
>
> So... <cfmail send the content of the query (including all the HTML code)
> How can I send email using <cfmail... but stripping all the html code but 
> still retain the basic formating (carriage return etc)
>
> Thanks for reading this basic question... 
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion is delivering applications solutions at at top companies 
around the world in government.  Find out how and where now
http://www.adobe.com/cfusion/showcase/index.cfm?event=finder&productID=1522&loc=en_us

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:288380
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to