Gossamer Forum
Home : Products : DBMan : Installation :

Email notification of new record DATA

Quote Reply
Email notification of new record DATA
I need the record data emailed to me.
I know the issue of email has been addressed in several posts, but only one I could find partially answers my question.
The most comprehensive I have seen is:
open (MAIL, "|/usr/lib/sendmail -t") or &cgierr("Can't open sendmail: $!");
print MAIL "To: youraddress\@yourdomain.com\n";
print MAIL "From: DBMan\n";
print MAIL "Subject: New user signup!\n\n";
print MAIL "A new user signed up on ", scalar localtime(), ".\n";
print MAIL "Userid: $in{'userid'}\n";
print MAIL "Pass: $in{'pw'}\n";
close MAIL;

Right after:

&html_signup_success;

in db.cgi (around line 700). Make sure to replace the email address with your own (and don't forget to escape the @).

This addresses notification of a new user added. I tried this under &html_add_success;
and it does not work. Is is supposed to?
I added the above code and no error messages occur, but mail does not get sent either.
Any help would be appreciated.

Thank You,
John

Quote Reply
Re: Email notification of new record DATA In reply to
Hmmmm. It works for me. I have the following in html_add_success, just after
my (%rec) = &get_record($in{$db_key});

Code:
open (MAIL, "|/usr/lib/sendmail -t") | | print "Can't start mail program";

print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: New Record Added\n\n";

print MAIL "-" x 75 . "\n\n";

print MAIL "A new record was added to the database:\n\n";

print MAIL " Name: $rec{'Name'}\n";
print MAIL "Email address: $rec{'Email'}\n\n";

close (MAIL);

I have $admin_email set to my email address. (I know it works because I got bombarded with email messages as I was adding records to test out other features! Smile )




------------------
JPD
Quote Reply
Re: Email notification of new record DATA In reply to
Maybe I'm off here, but if you want to capure the record data, you need to place the mail statements after:

&html_add_success;

Anyway that's how it works for me.
Hope this helps.
PB:-)
Quote Reply
Re: Email notification of new record DATA In reply to
Are you running on Unix or NT?

If you are on NT, sendmail will not work. You will have to use something other program to do the mailing (like "blat").

Cheers
-JO