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

CFMAIL Body

Status
Not open for further replies.

boatguy

Programmer
Oct 22, 2001
153
US
Hi,

I am trying to populate my cfmail body by pulling the info from a MSSQL text field.

cfmail looks like this:
Code:
<cfmail to="#Email#" from="#specemail#" subject="Your specs file" type="html"> 
#getspecfilemessage.emailtext#
</cfmail>

The data in the text field looks like:
Code:
<table width="600" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="600" align="right" bgcolor="##122F69"><img src="[URL unfurl="true"]http://www.xxx.com/emailhdr.jpg"></td>[/URL]
  </tr>
  <tr>
  <td width="600"><br>
<br>
Hello #FName#,<br>
<br>
Thank you for your inquiry. Your spec file is attached. If you would like a dealer to contact you, please <a href="[URL unfurl="true"]http://www.xxx.com?id=#lastid#">click[/URL] here</a>.

<br><br>

If I can be of further assistance to you, please don't hesitate to contact me.<br>
   </tr>
  </table>

My problem is, the email arrives but the variables are not populated. For example Hi #FName# looks just like that as opposed to Hi JohnDoe.

It acts like it ignores the ##.

Any suggestions?
 
You're pulling the actual body of the email from a table from your dB as #getspecfilemessage.emailtext#, but from where in the data itself are you populating the FName var?

In other words, you have a database field that has this:
Code:
<table width="600" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="600" align="right" bgcolor="##122F69"><img src="[URL unfurl="true"]http://www.xxx.com/emailhdr.jpg"></td>[/URL]
  </tr>
  <tr>
  <td width="600"><br>
<br>
Hello [b]#FName#[/b],<br>
<br>
Thank you for your inquiry. Your spec file is attached. If you would like a dealer to contact you, please <a href="[URL unfurl="true"]http://www.xxx.com?id=[/URL][b]#lastid#[/b]">click here</a>.

<br><br>

If I can be of further assistance to you, please don't hesitate to contact me.<br>
   </tr>
  </table>

as its value, and this is the value that you are emailing your customers, but how are you populating the FNAME var?

What does your getspecfilemessage query look like? And, does the id var in the link get populated or the same thing happens?


____________________________________
Just Imagine.
 
You're trying to populate variables inside a variable. It would be much easier just to have this as the body of your mail tag, and run the query to get the Name & ID info.
Code:
<table width="600" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="600" align="right" bgcolor="##122F69"><img src="[URL unfurl="true"]http://www.xxx.com/emailhdr.jpg"></td>[/URL]
  </tr>
  <tr>
  <td width="600"><br>
<br>
Hello #FName#,<br>
<br>
Thank you for your inquiry. Your spec file is attached. If you would like a dealer to contact you, please <a href="[URL unfurl="true"]http://www.xxx.com?id=#lastid#">click[/URL] here</a>.

<br><br>

If I can be of further assistance to you, please don't hesitate to contact me.<br>
   </tr>
  </table>
I think you're overcomplicating things by having this info in the database, pulling it out, then having to go back to the database and pull more info just so that the info you just pulled can be used.


Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
Hi and thanks for your response. The reason for the dB pull on the body is to give the client the ability to edit the email copy at random. The Fname and ID vars are passed from a form and from an identity var passed when the lead is inserted into the database. The flow is:
Visitor fills out a form
Form data is entered into the database
identity field is set (id)
cfmail tag executes with data populated from the form (fname and to email address) last id into lead table and the body copy from the email text table.

Note that this app has 8 cfmail functions that get invoked based of based on where the user comes from when they hit the contact form. I am using if statements to pull the correct email body. So, the subsequent reply email back to the user changes if they are looking for a demo ride, want a dealer to contact them, are requesting a brochure etc.

I suppose I could just give them the ability to edit certain parts of the email body and leave the sections like fname hard coded.
 
Gotcha. Yeah, you may find it easier to do something like this:
Code:
<table width="600" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="600" align="right" bgcolor="##122F69"><img src="[URL unfurl="true"]http://www.xxx.com/emailhdr.jpg"></td>[/URL]
  </tr>
  <tr>
  <td width="600"><br>
    <br>
    Hello #Form.FName#,<br>
    <br>
    #getspecfilemessage.emailtext#
   </td>
   </tr>
  </table>

Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
Agreed and once again I greatly appreciate your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top