Right now I have a page set up that inserts a record into a DB that a user enterd. I have it set up to take them to another page that shows the the information that they entered. but I also have a cfmail tag that e-mails the same information to their e-mail. the only problem is when it goes to their email it doesn't show up the way I want it to. I want it to be inside of a table but when it shows up in their account it just shows the html tags. the only email client that shows it how I want it to display is hotmail. in gmail and and other accounts it just shows the HTML code.

here is my code

<cflock name="NewRecordInsert" type="exclusive" timeout="30">
<cftransaction>
<cfquery name="RecordInsert" datasource="Rumors_Forms">
				 INSERT INTO Bus (Name, Req_Date, Req_Time, Address, Email, PhoneNumber, Reason)
				 Values('#form.Name#', '#form.Month#/#form.Day#/#form.Year#' ,'#form.Req_Time#','#form.Address#','#form.Email#','#form.PhoneNumber#','#form.Reason#')
</cfquery>

<cfquery name="GetPK" datasource="Rumors_Forms">
				 SELECT Max(ID) AS MaxID
				 FROM Bus
</cfquery>
</cftransaction>
</cflock>

<cfquery name="GetRecord" datasource="Rumors_Forms">
				 SELECT ID, Name, Req_Date, Req_Time, Address, Email, PhoneNumber, Reason
				 FROM Bus
				 WHERE ID = #GetPK.MaxID#
</cfquery>

<cfmail query="GetRecord"
				from="donotreply@rumorssportsbar.com"
				to="#form.Email#"
				bcc="ericstauss@gmail.com"
				subject="Bus Reservation">
<html>			
Here is your information that you entered
<table border="1" cellpadding="0">
				 <tr>
				 		 <th>Confirmation Number</th>
						 <th>Name</th>
						 <th>Date</th>
						 <th>Time</th>
						 <th>Address</th>
						 <th>E-mail</th>
						 <th>Phone Number</th>
						 <th>Purpose of Rental</th>
				 </tr>
				 <cfoutput>
				 <tr>
				 		 <td>#ID#</td>
						 <td>#Name#</td>
						 <td>#Req_Date#</td>
						 <td>#Req_Time#</td>
						 <td>#Address#</td>
						 <td>#Email#</td>
						 <td>#PhoneNumber#</td>
						 <td>#Reason#</td>
				 </tr>
				 </cfoutput>	
				 </table>
Do not loose your confirmation number as you will need to to get the bus, you can also edit your settings with the number
</html></cfmail>	
				
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Rumors Bar & Grill | Review Entry</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="style.css" type="text/css">
<style type="text/css">
th{
	 background-color: #888888;
}
td {
	 background-color: #CoCoCo;
	 }
</style>
</head>
<body>


	<div id="page">
	
    <div id="header"><img src="Images/top3.jpg"></div>
			    
        	
    <div id="nav" bordercolor="ffffff"> <cfinclude template="navigation.cfm"> </div>
			    	
    	   	
    <div id="content" valign="top"> 
				 <br>
				 <table border="1" cellpadding="0">
				 <h2>The Bus has been reserverd!!</h2>
				 <h3>Here are the details...</h3>
				 
				 <tr>
				 		 <th>Confirmation Number</th>
						 <th>Name</th>
						 <th>Date</th>
						 <th>Time</th>
						 <th>Address</th>
						 <th>E-mail</th>
						 <th>Phone Number</th>
						 <th>Purpose of Rental</th>
				 </tr>
				 <cfoutput query="GetRecord">
				 <tr>
				 		 <td>#ID#</td>
						 <td>#Name#</td>
						 <td>#Req_Date#</td>
						 <td>#Req_Time#</td>
						 <td>#Address#</td>
						 <td>#Email#</td>
						 <td>#PhoneNumber#</td>
						 <td>#Reason#</td>
				 </tr>
				 </cfoutput>	
				 </table>

    </div>
		    	    
    <div id="right" valign="top">and here is extra, maybe an ad or something</div>
		
		<!--<div id="footer">copyright and what not</div>-->
		
	</div>
		
		
	

</body>
</html>

I was just about to update my post. I found that tag and put that in my code. and now it works for every email client except Gmail. I have had HTMl emails sent to my account before and I know they work. Also with those tags there, it works in all other email clients, but now it just shows up as a blank email in Gmail

You may need to send a plain one for Gmail so if would go

<cfmail>
<cfmailpart type="plain">

Plain text here

</cfmailpart>

<cfmailpart type="html">

HTML CODE HERE

</cfmailpart>
</cfmail>

when I have the cfmail part in there, that is what causes nothing to show up in gmail. when I remove it than it shows up with the tags

I was able to get this issue solved. thanks for your help

I have used the cfmail tag alot but dont get the following to work. I have a form were a system administrator can submit a email to all subscribers informing them of 'something', whatever.

My problem is, the text area field is being used for the body of the mail being send via cfmail query

How do I transform the {NAME} inside the textare to the users real name when the cfmail page process the textarea content.

<textarea name="body" cols="30" rows="4" id="body">Dear {NAME}, welcome to our site.</textarea> <-- This gets pass onto the cfmail page for processing?

I have used the cfmail tag alot but dont get the following to work. I have a form were a system administrator can submit a email to all subscribers informing them of 'something', whatever.

My problem is, the text area field is being used for the body of the mail being send via cfmail query

How do I transform the {NAME} inside the textare to the users real name when the cfmail page process the textarea content.

<textarea name="body" cols="30" rows="4" id="body">Dear {NAME}, welcome to our site.</textarea> <-- This gets pass onto the cfmail page for processing?

You can string replace the {NAME} with the user's name (which I assume is on a form somewhere). For example:

<cfset mailBody = Replace(form.body, "{NAME}", form.name, "all") />

You can string replace the {NAME} with the user's name (which I assume is on a form somewhere). For example:

<cfset mailBody = Replace(form.body, "{NAME}", form.name, "all") />

Thanks, i have tried that method, and its working but the cfmail is sending to 4 users in a recordset, but all 4 emails shows only the 1st records name. The code:

-->Form<--

<form id="mail1" name="mail1" method="post" action="test_1.cfm">
<table border="0" cellspacing="0" cellpadding="5">
<tr>
<td>Subject</td>
<td><label>
<input name="subject" type="text" id="subject" />
<input name="name" type="hidden" value="<cfoutput>#rsSubscribersMail.name#</cfoutput>" />
</label></td>
</tr>
<tr>
<td>From</td>
<td><label>
<input name="from" type="text" id="from" />
</label></td>
</tr>
<tr>
<td>Body</td>
<td><label>
<textarea name="body" cols="30" rows="4" id="body">Hello {NAME}</textarea>
</label></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><label>
<input type="submit" name="Submit" value="Submit" />
</label></td>
</tr>
</table>
</form>

-->CFMail Page<--

<cfquery name="rsSubscribersMail" datasource="DATA">
SELECT subscriber.subscriberID, subscriber.name, subscriber.surname, subscriber.email
FROM subscriber
</cfquery>

<cfset mailBody = Replace(#form.body#, "{NAME}", #rsSubscribersMail.name#, "all") />

<cfmail query="rsSubscribersMail" to="#rsSubscribersMail.email#" from="#form.from#" subject="#form.subject#" server="127.0.0.1" port="25">
#mailBody#
</cfmail>

You need to cfloop through the query.

<cfquery name="rsSubscribersMail" datasource="DATA">
SELECT subscriber.subscriberID, subscriber.name, subscriber.surname, subscriber.email
FROM subscriber
</cfquery>

<cfloop query="rsSubscribersMail">

  <cfset mailBody = Replace(#form.body#, "{NAME}", #rsSubscribersMail.name#, "all") />

  <cfmail to="#rsSubscribersMail.email#" from="#form.from#" subject="#form.subject#" server="127.0.0.1" port="25">
  #mailBody#
  </cfmail>

</cfloop>

If you don't loop through the query, it will always use the values from the first record.

You need to cfloop through the query.

<cfquery name="rsSubscribersMail" datasource="DATA">
SELECT subscriber.subscriberID, subscriber.name, subscriber.surname, subscriber.email
FROM subscriber
</cfquery>

<cfloop query="rsSubscribersMail">

  <cfset mailBody = Replace(#form.body#, "{NAME}", #rsSubscribersMail.name#, "all") />

  <cfmail to="#rsSubscribersMail.email#" from="#form.from#" subject="#form.subject#" server="127.0.0.1" port="25">
  #mailBody#
  </cfmail>

</cfloop>

If you don't loop through the query, it will always use the values from the first record.

Is it possible to 'replace' more than one, {Name} {SURNAME}

Is it possible to 'replace' more than one, {Name} {SURNAME}

You can use a second Replace function:

<cfset mailBody = Replace(#form.body#, "{NAME}", #rsSubscribersMail.name#, "all") />
<cfset mailBody = Replace(#mailbody#, "{SURNAME}", #rsSubscribersMail.surname#, "all") />
This question has already been answered. Start a new discussion instead.