Solved

Known issues with CFmail and CFquery?

Posted on 2004-09-03
4
310 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

730 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