Solved

Known issues with CFmail and CFquery?

Posted on 2004-09-03
4
301 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

11 Experts available now in Live!

Get 1:1 Help Now