954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

<cfmail> question

top3.jpg
The Bus has been reserverd!! Here are the details... Confirmation Number Name Date Time Address E-mail Phone Number Purpose of Rental #ID# #Name# #Req_Date# #Req_Time# #Address# #Email# #PhoneNumber# #Reason# and here is extra, maybe an ad or something

Stewie
Light Poster
30 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

you need to use the following:

HTML CODE HERE

billythehamster
Light Poster
29 posts since May 2006
Reputation Points: 10
Solved Threads: 3
 

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

Stewie
Light Poster
30 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

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

Plain text here

HTML CODE HERE

billythehamster
Light Poster
29 posts since May 2006
Reputation Points: 10
Solved Threads: 3
 

I will try that. Thank you

Stewie
Light Poster
30 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

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

Stewie
Light Poster
30 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

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

Stewie
Light Poster
30 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

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.

Dear {NAME}, welcome to our site. <-- This gets pass onto the cfmail page for processing?

creative72
Newbie Poster
4 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

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.

Dear {NAME}, welcome to our site. <-- 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") />
cmhampton
Junior Poster in Training
79 posts since Feb 2008
Reputation Points: 23
Solved Threads: 10
 

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<--


Subject


From


Body

Hello {NAME}
 


-->CFMail Page<--


SELECT subscriber.subscriberID, subscriber.name, subscriber.surname, subscriber.email
FROM subscriber

#mailBody#

creative72
Newbie Poster
4 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

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.

cmhampton
Junior Poster in Training
79 posts since Feb 2008
Reputation Points: 23
Solved Threads: 10
 

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}

creative72
Newbie Poster
4 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 
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") />
cmhampton
Junior Poster in Training
79 posts since Feb 2008
Reputation Points: 23
Solved Threads: 10
 

Thanks, manage to get all sorted thanks to your assistance...

creative72
Newbie Poster
4 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You