Gossamer Forum
Home : Products : DBMan : Customization :

Auto Rejection Email after deleting entry

Quote Reply
Auto Rejection Email after deleting entry
Hi all,

I've got my installation allowing me to delete any entry from my database by clicking a link shown along side each record when they are viewed. This is the link code...

Code:
<a href="$db_script_link_url&$db_key=$rec{$db_key}&$rec{'jobkey'}=delete&delete_records=Delete+Checked">Delete</a>

This is working fine.

Now I would also like the system to automatically send a rejection email to the submitter at the same time.

I've been looking at JPDeni's mod for sending an email after adding a record, and have been trying to modify it to send an email after deletion (by placing my customised code in the sub html_delete_success sub routine) without much luck.

Anyone have any suggestions?

Thanks in advance!
Quote Reply
Re: [Moby] Auto Rejection Email after deleting entry In reply to
delete_success would be the right place as far as I know.... what about the email doesn't work? Have you done any emailing before in the script (such emailing upon adding a record?)
Quote Reply
Re: [Watts] Auto Rejection Email after deleting entry In reply to
Here's a thread taken from the DBMan FAQ:


529 22-Oct-2001 Last Modified: 22-Oct-2001

Email upon deletion of record

If you haven't already done so, add the following to your .cfg file:

In db.cgi, sub delete_records, change:

$delete_list{$data[$db_key_pos]} ? # if this id is one we want to delete
($delete_list{$data[$db_key_pos]} = 0) : # then mark it deleted and don't print it to the new database.
($output .= $line . ''\n''); # otherwise print it.

to code:

if ($delete_list{$data[$db_key_pos]}) {
$delete_list{$data[$db_key_pos]} = 0; # then mark it deleted and don't print it to the new database.

open (MAIL, ''$mailprog'') or &cgierr(''Can't start mail program'');
print MAIL ''To: $data[$auth_email_field]\n'';
print MAIL ''From: $admin_email\n'';
print MAIL ''Subject: $html_title Confirmation of Deleted Record\n\n'';
print MAIL ''-'' x 75 . ''\n\n'';
print MAIL ''Your record at $html_title, which had the following information:\n'';
for ($i=0;$i<=$#db_cols ;++$i) {
print MAIL ''$db_cols[$i]: $data[$i]\n'';
}
print MAIL ''\nhas been deleted from the database.\n\n'';
close MAIL;
}
else {
$output .= $line . ''\n''; # otherwise print it.
}

This will send out individual email messages for each record that is deleted.

Hope this helps

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/