Gossamer Forum
Home : Products : DBMan : Customization :

short/long email notification on change

Quote Reply
short/long email notification on change
I am using the short/long modification with great success. However, when trying to notify the administrator (without validation) that a record was added or modified, I get no information in the body of the email except:

The following new record has been added to the database:.

--

It worked fine without the short/long mod, so I expect it has something to do with the bolded section below.

I've search the forum and can't seem to find the solutions. Here's the mail routine:

my (%rec) = &get_record($in{$db_key});

open (MAIL, "$mailprog") || &cgierr("Can't start mail program");
print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: $html_title New Record\n\n";
print MAIL "The following new record has been added to the database:\n\n";
foreach $col ($db_cols) {
print MAIL "$column: $rec{$column}\n"; }
close (MAIL);


Thanks in advance.

Quote Reply
Re: [bbooker] short/long email notification on change In reply to
Two thoughts:

1) perhaps the $db_key is being returned with search formatting somehow. You can try putting before %rec...

$in{$db_key} =~ s/<?.B>//g;

2) the %rec needs to be global and not local. Try getting rid of the my() and see if that helps.
Quote Reply
Re: [bbooker] short/long email notification on change In reply to
In sub html_add_success I use:

%rec=&get_record($in{$db_key});
&html_record_long(%rec);

open (MAIL, "$mailprog") or &cgierr("Can't open sendmail!\n");
etc.

Try changing:

foreach $col ($db_cols) {
print MAIL "$column: $rec{$column}\n"; }

To:

foreach $column(@db_cols) {
print MAIL "$column: $rec{$column}\n";

or another version used:

foreach $column(@db_cols) {
print MAIL "$column: $in{$column}\n";

Hope this helps

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] short/long email notification on change In reply to
Yup, I missed that one... Blush

Lois is right. Your foreach needs to match. Use either $col or $column, but not both. Tongue
Quote Reply
Re: [LoisC] short/long email notification on change In reply to
Thanks to everyone. That worked great.