Gossamer Forum
Home : Products : DBMan : Customization :

email mod -- email sent, but not record

Quote Reply
email mod -- email sent, but not record
I've installed the email_after_add modification. It sends an email to the admin and the user. However, the admin email does not contain any of the record that was added -- just the default language. I've pasted the mod as it is installed in sub html_add_success portion of the html.pl file.

Thanks,

John


open (MAIL, "$mailprog") || &cgierr("Can't start mail program");

########
# Be sure to change the name of the field below to match your email
# field name
########

print MAIL "To: $rec{'Email'}\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: Welcome to $html_title\n\n";

#######
# Be sure to write your welcome message. You may use the $rec{'FieldName'}
# variables to include values from the record if you wish.
#######

print MAIL "Enter your welcome message here.";
close (MAIL);

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 "$col -- $rec{$col}\n";
}
close (MAIL);
Quote Reply
Re: [jgold723] email mod -- email sent, but not record In reply to
The way I use it is as follows:

Replace your line:

print MAIL "$col -- $rec{$col}\n";


with:

print MAIL "Fieldname 1: $rec{'Fieldname1'}\n";
print MAIL "Fieldname 2: $rec{'Fieldname2'}\n";
print MAIL "Fieldname3: $rec{'Fieldname3'}\n";
print MAIL "Fieldname 4: $rec{'Fieldname4'}\n";

and so on, using any fields you wish.

Try it.
-------------
David Olley
Anglo & Foreign International Limited,
http://www.firehelmets.co.uk

There are 10 types of people in the world: those who understand binary, and those who don't.
Quote Reply
Re: [davidolley] email mod -- email sent, but not record In reply to
The problem is a long existing bug in the code that needs fixing.

Code:
foreach $col ($db_cols) {

Should be:

Code:
foreach $col (@db_cols) {
Quote Reply
Re: [Paul] email mod -- email sent, but not record In reply to
Thanks very much for that Paul, you genius! Smile
-------------
David Olley
Anglo & Foreign International Limited,
http://www.firehelmets.co.uk

There are 10 types of people in the world: those who understand binary, and those who don't.
Quote Reply
Re: [davidolley] email mod -- email sent, but not record In reply to
David: Thanks! That worked like a charm.

John