You would not have to create a new sub-routine for the email routine. It can be placed as a part of the
sub add_record routine.
For example:
(This example is used with the
sub add_record routine in conjunction with the Validate records mod.)
Code:
open (MAIL, "$mailprog") | | &cgierr("unable to open mail program");
print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: Record Added to $html_title\n\n";
print MAIL "The following Record is waiting to be validated:\n\n";
print MAIL "Record ID: $rec{'ID'}\n";
print MAIL "Organization:
$rec{'Organization'}\n";
print MAIL "Job Title: $rec{'Position'}\n\n";
print MAIL "---------------------------------------------------\n";
print MAIL "You can use the Validation Form to validate or delete\n";
print MAIL "this Job Posting.\n";
print MAIL "----------------------------------------------\n\n";
print MAIL "Environmental Variables for Tracking Purposes:\n\n";
print MAIL "Remote Host: $ENV{REMOTE_HOST}\n";
print MAIL "Remote Addr: $ENV{'REMOTE_ADDR'}\n";
print MAIL "Referer: $ENV{'HTTP_REFERER'}\n";
print MAIL "Submitted Using: $ENV{'HTTP_USER_AGENT'}\n";
close (MAIL);
Place these after
&html_add_success;.
You would have to add these variables to your
default.cfg file:
Code:
$mailprog = "|/usr/lib/sendmail -t -oeq";
$admin_email = 'youraccount@yourserver.com";
Of course, you would have to change the path to your sendmail program and also change the email address.
In terms of selecting certain fields in the forms to be added to your database, that would need to be thought of more in-depth. In terms of emailing all the fields, you can add all the fields between the print MAIL ""; statments in your database which would be sent to you. Make sure that you put $rec{'FieldName'} for each field that you want to be sent to you.
Regards,
------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
[This message has been edited by Eliot (edited September 06, 1999).]