I needed to be able to write form submissions to a CSV file for backup and data manipulation. The following patch does the job.
NOTES:
- It requires Text::CSV be availble
- A new config parameter called 'csv_file' is expected with the path to write the file to
- A header line is only output if the file exists and size is 0
- If you change your form, you should reset your csv file. No warnings are in place to let you know that changes are happening.
CGI::NMS::Script::FormMail.pm diff
Logged In: YES
user_id=224605
Originator: YES
In addition, if you want fields like 'email' to come through into the csv file, you need to add include_config_NAME. Here's an example of a %more_config settings for setting the csv_file and include:
%more_config = (
'csv_file' => '/home/garlicgold/public_html/cgi/sample_form_db.csv',
'include_config_email' => 1,
);
Logged In: YES
user_id=34146
Originator: NO
I'm not going to add this patch as it's outside the scope of a Formmail program, and this functionality is already available in TFMail (which we'd like to encourage people to use).