Solved

Known issues with CFmail and CFquery?

Posted on 2004-09-03
4
302 Views
Last Modified: 2013-12-24
I'm facing a problem with inserting into a db in a cftransaction and right after that sending an e-mail.
the cf transaction contains a number of queries, and last one is the insert query.
I tried both ways (since i would like to send the e-mail only when the data is successfully inserted) to put the cfmail inside the cftransaction tag, and outside it.

In any case, all the queries excute correctly except the insert query. If i remove the cfmail, the problem is still presisting. Only when i delete the query and rewrite it (of course no cfmail in this case) that it works!

Any ideas?
0
Comment
Question by:MMsabry
  • 2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:hart
ID: 11971210
one suggestion woul be to put all your queries in a stored procedure if possible...
and after the insert quert send a variable out from the stored proc that indicates wether to send the mail or not...

Regards
Hart
0
 
LVL 11

Accepted Solution

by:
hart earned 250 total points
ID: 11971216
also don't put the cfmail inside the cftransaction...
inside cftransaction if an error occurs then set a variable to no...

annd before sending the email check wether the variables value is yes or not...

Regards
Hart
0
 

Author Comment

by:MMsabry
ID: 11971323
That might work, but do you know why the insert does not function when the cfmail tag is there?
i can understand if everything is wrapped in a cftransaction, but when this is not the case!
0
 

Author Comment

by:MMsabry
ID: 11972303
Hart,
Thanks for the ideas, they work, but i made a small modification!
I just initialized a variable default "0", and in the transaction i set it to value "1"
I use a cfif statement, if evaluates to true, i include the e-mail template.
Although i think your solution of stored procedures is more elegant, I have no experience with stored procedures!
thanks once more
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now