User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ColdFusion section within the Web Development category of DaniWeb, a massive community of 427,750 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,710 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ColdFusion advertiser: Programming Forums
Views: 5036 | Replies: 13 | Solved
Reply
Join Date: Apr 2006
Posts: 29
Reputation: Stewie is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Stewie Stewie is offline Offline
Light Poster

<cfmail> question

  #1  
Jun 4th, 2006
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

[html]
<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>

[/html]
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2006
Posts: 28
Reputation: billythehamster is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 3
billythehamster billythehamster is offline Offline
Light Poster

Re: <cfmail> question

  #2  
Jun 6th, 2006
you need to use the following:

<cfmail>
<cfmailpart type="html">

HTML CODE HERE

</cfmailpart>
</cfmail>
Reply With Quote  
Join Date: Apr 2006
Posts: 29
Reputation: Stewie is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Stewie Stewie is offline Offline
Light Poster

Re: <cfmail> question

  #3  
Jun 6th, 2006
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
Reply With Quote  
Join Date: May 2006
Posts: 28
Reputation: billythehamster is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 3
billythehamster billythehamster is offline Offline
Light Poster

Re: <cfmail> question

  #4  
Jun 6th, 2006
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>
Reply With Quote  
Join Date: Apr 2006
Posts: 29
Reputation: Stewie is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Stewie Stewie is offline Offline
Light Poster

Re: <cfmail> question

  #5  
Jun 6th, 2006
I will try that. Thank you
Reply With Quote  
Join Date: Apr 2006
Posts: 29
Reputation: Stewie is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Stewie Stewie is offline Offline
Light Poster

Re: <cfmail> question

  #6  
Jun 8th, 2006
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
Reply With Quote  
Join Date: Apr 2006
Posts: 29
Reputation: Stewie is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Stewie Stewie is offline Offline
Light Poster

Re: <cfmail> question

  #7  
Jun 9th, 2006
I was able to get this issue solved. thanks for your help
Reply With Quote  
Join Date: Jun 2008
Posts: 4
Reputation: creative72 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
creative72 creative72 is offline Offline
Newbie Poster

Re: <cfmail> question

  #8  
Jun 24th, 2008
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?
Reply With Quote  
Join Date: Feb 2008
Posts: 70
Reputation: cmhampton is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 10
cmhampton's Avatar
cmhampton cmhampton is offline Offline
Junior Poster in Training

Re: <cfmail> question

  #9  
Jun 24th, 2008
Originally Posted by creative72 View Post
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:

  1. <cfset mailBody = Replace(form.body, "{NAME}", form.name, "all") />
Reply With Quote  
Join Date: Jun 2008
Posts: 4
Reputation: creative72 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
creative72 creative72 is offline Offline
Newbie Poster

Re: <cfmail> question

  #10  
Jun 24th, 2008
Originally Posted by cmhampton View Post
You can string replace the {NAME} with the user's name (which I assume is on a form somewhere). For example:

  1. <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>
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ColdFusion Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ColdFusion Forum

All times are GMT -4. The time now is 12:54 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC