943,940 Members | Top Members by Rank

Ad:
  • ColdFusion Discussion Thread
  • Marked Solved
  • Views: 8909
  • ColdFusion RSS
You are currently viewing page 1 of this multi-page discussion thread
Jun 4th, 2006
0

<cfmail> question

Expand Post »
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]
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
Stewie is offline Offline
30 posts
since Apr 2006
Jun 6th, 2006
0

Re: <cfmail> question

you need to use the following:

<cfmail>
<cfmailpart type="html">

HTML CODE HERE

</cfmailpart>
</cfmail>
Reputation Points: 10
Solved Threads: 3
Light Poster
billythehamster is offline Offline
29 posts
since May 2006
Jun 6th, 2006
0

Re: <cfmail> question

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
Reputation Points: 10
Solved Threads: 0
Light Poster
Stewie is offline Offline
30 posts
since Apr 2006
Jun 6th, 2006
0

Re: <cfmail> question

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>
Reputation Points: 10
Solved Threads: 3
Light Poster
billythehamster is offline Offline
29 posts
since May 2006
Jun 6th, 2006
0

Re: <cfmail> question

I will try that. Thank you
Reputation Points: 10
Solved Threads: 0
Light Poster
Stewie is offline Offline
30 posts
since Apr 2006
Jun 8th, 2006
0

Re: <cfmail> question

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
Reputation Points: 10
Solved Threads: 0
Light Poster
Stewie is offline Offline
30 posts
since Apr 2006
Jun 9th, 2006
0

Re: <cfmail> question

I was able to get this issue solved. thanks for your help
Reputation Points: 10
Solved Threads: 0
Light Poster
Stewie is offline Offline
30 posts
since Apr 2006
Jun 24th, 2008
0

Re: <cfmail> question

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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
creative72 is offline Offline
4 posts
since Jun 2008
Jun 24th, 2008
0

Re: <cfmail> question

Click to Expand / Collapse  Quote originally posted by creative72 ...
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:

ColdFusion Syntax (Toggle Plain Text)
  1. <cfset mailBody = Replace(form.body, "{NAME}", form.name, "all") />
Reputation Points: 23
Solved Threads: 10
Junior Poster in Training
cmhampton is offline Offline
79 posts
since Feb 2008
Jun 25th, 2008
0

Re: <cfmail> question

Click to Expand / Collapse  Quote originally posted by cmhampton ...
You can string replace the {NAME} with the user's name (which I assume is on a form somewhere). For example:

ColdFusion Syntax (Toggle Plain Text)
  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>
Reputation Points: 10
Solved Threads: 0
Newbie Poster
creative72 is offline Offline
4 posts
since Jun 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ColdFusion Forum Timeline: Insert query.
Next Thread in ColdFusion Forum Timeline: multiple left outer joins on query of query





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC