Gossamer Forum
Home : Products : DBMan : Customization :

Trouble with Send email after record is added last

Quote Reply
Trouble with Send email after record is added last
I have just implemented JP Deni's MOD "Send email after record is added"

The problem is that the email does not contain the record. I am able to receive the emails but they do not have the record included. Can anyone help?

Best regards!

Raza
Quote Reply
Re: [RAZA] Trouble with Send email after record is added last In reply to
It's hard to guess what could be wrong without seeing the portion of code that you are using in add_success.

There are different versions depending on whether you define the output yourself or whether you are sending ALL record information.

You can either check the FAQ (noted below) under the section for "Email" and view the threads related to this, or provide the portion of code you are using so we can see what may need to be modified.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Trouble with Send email after record is added last In reply to
The modified code in html.pl is as follows:


sub html_add_success {
####################################################################
# S E N D E M A I L A F T E R R E C O R D I S A D D E D
#
# by JPDeni
# last edited 2 May 2001
#
# To send mail to the admin after a record is added
#
# script: html.pl
# sub html_add_success
#
# add new lines
#
# Where to put it--
# right at the beginning of the subroutine, before any other lines
###################################################################

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);

# --------------------------------------------------------
# The page that is returned upon a successful addition to
# the database. You should use &get_record and &html_record
# to verify that the record was inserted properly and to make
# updating easier.

&html_print_headers;
print qq|
<html>
<head>
<title>$html_title: Record Added.</title>
</head>

<body bgcolor="#FFFFFF">
$html_head_text

<table border=0 bgcolor="#FFFFFF" cellpadding=5 cellspacing=3 width=90% align=center valign=top>
<tr><td colspan=2 bgcolor="#e7ba42">
<FONT FACE="arial,helvetica" size=1 COLOR="#000000">
<b>$html_title: Record Added</b>
</td></tr>
<tr><td>
<p><center><$font_title><b>
Record Added
</b></font></center><br>
<$font>
<P><Font face="Verdana, Arial, Helvetica" Size=2>The following record was successfully added to the database:</FONT>
|; &html_record(&get_record($in{$db_key})); print qq|
</font></p>
|; &html_footer; print qq|
</td></tr>
</table>
</center>
</body>
</html>
|;
}




And this is what I have added in default.cfg

# Full path to sendmail on your system
$mailprog = "|/usr/lib/sendmail -t";
# Your email address
$admin_email = 'webmaster@aarknet.com';

I want the entire record details to be received in the email but I receive an empty email with the following body text:
The following new record has been added to the database:.

--

and following subject line:
Subject: Jobs Listing at GulfJobSites.com New Record



Please advise what needs to be corrected.

Thanks for your time.

Raza
Quote Reply
Re: [RAZA] Trouble with Send email after record is added last In reply to
Try changing:

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

to:

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

Unoffical DBMan FAQ

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