Skip to main content
Inspiring
June 10, 2012
Question

application.cfc and email notification

  • June 10, 2012
  • 1 reply
  • 823 views

I posted this a couple weeks ago in the general coldfusion forum but got no replies.  If what I'm asking is impossible, I'd appreciate it if you'd just let me know--or if there's a different way to do what I want that I'm unaware of.  Thanks.

------------------------------------------------------------------

I'm in the process of finishing a website and it is heavily dependent on user interaction.  It has lots of different forms and message board and, when I launch it, I'd really like to be notifvied by email whenever someone posts anything on any page of the site, so I can respond in the early going before many people have started to use the site.

Currently, I have email notification set up for private messages sent from user to user, so I know how to do that.  But it would be a real pain to have to go through every page on the site that has a form and insert the code that notifies me whenever something is posted.  I only need to do this with me--I just want to know whenever someone posts, nobody else but me has to know whenever someone posts anything on the site.


So my question is, is there some way I can insert some code into application.cfc to notify me whenever anyone posts anything so I don't have to go through every single page and insert the code myself

Or maybe there is a way to do it that doesn't involve application.cfc, I don't know.  Anything that does what I'm asking will be greatly appreciated.

This topic has been closed for replies.

1 reply

Inspiring
June 10, 2012

You can do lot's of things in Application.cfc.  If posting is done by form, in your onRequestStart method, you can do something like:

if (structkeyexists(form,"fieldnames") is true)

send mail to yourself.

wycksAuthor
Inspiring
June 10, 2012

Thanks,

I'm not all too advanced with coldfusion--I've kind of been learning as I go, so, in the bit of code you gave me above, do I need to actually include every different form name or does "fieldnames" cover any form on any page?

Inspiring
June 11, 2012

Submit a form to a page with only this code:

<cfdump var-"#form#">

Then you'll know whether or not my answer was correct.