Add emailOptions and emailMessage to hooks->fields so another Hook can use data.
Add emailOptions and emailMessage to hooks->fields so another Hook can grab and save to DB. I am working on a simple hook that will save the email to a database table.
Note I created 2 new options for the email hook: emailLog and logCategory. emailLog is boolean and defaults to false, this tells the hook whether or not to log to the database. I added the logCategory which is a string and which could be used in sorting through the log files. I did not create a method to store any attachments.
@jgulledge19 FormIt is now maintained at the modxcms repository. I've merged this with develop there and created a new testing branch https://github.com/modxcms/FormIt/commit/4bfd709da15b41d588b5bdc1d5608aba4ad8422e
So, this adds the ability to log form entries to the database, as well as email them to admins. Is that correct?
Interesting, this sort of reminds me of FormSave, but slightly different: http://rtfm.modx.com/extras/revo/formsave
Native or not, I do think it's an important feature.
@jpdevries yes it is meant to log the created email to the DB. I have not reviewed my submitted code in quite some time.
Little more depth on how I have used a similar feature I wrote.
As you probably know when PHP mail or SMTP fails the emails are completely lost. Some years back our email upgrade broke email relay and with thousands of contact forms I created a log database for this, that is what is included in the code submitted. I also scripted a redelivery method that ran via a scheduled task and would send out these lost messages and prepended the email with a statement of time originally sent. Along with that I developed a web grid view to sort, view and resend emails. I did not write these for the FormIT extra but those could also be helpful. You might be surprised on how many times SMTP fails and if their is no log and resend method this can be big trouble.
If I can find some time, maybe in a few months I will review further. It might be helpful to create a this functionality lower down as part of modMail or a modMail extension. Then any extras that send mail can auto log it and have a method to review/send any lost ones.
@jgulledge19 if you could review it further and we could do some testing to make sure it doesn't introduce any major issues or break anything we might be able to merge this in. thanks!