Gossamer Forum
Home : Products : DBMan : Customization :

Automatic e-mail notification?

Quote Reply
Automatic e-mail notification?
Hi guys, my question is: If someone adds a record as a default user, how can I get automatic notification of that action?
Is it possible to configure DBMAN to auto send the admin an e-mail with that information? The user who addds the record is not logged in (doesn't have user ID/pwd); but default permissions will allow him to add and view records.
Quote Reply
Re: Automatic e-mail notification? In reply to
Sure! You can add your email notification routine into the html_add_success subroutine.

I would define your path to sendmail in the .cfg file, as well as your email address (makes it easier to change things later on, if necessary.)

$mailprog = $mailprog = "|/usr/lib/sendmail -t";
$admin_email = "you\@server.com";

(Be sure to keep the \ before the @ in your email address!)

Then somewhere in html_add_success, add

open (MAIL, $mailprog) | | print "Can't start mail program";
print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: New Addition\n\n";
print MAIL "[whatever you want to say to yourself];
close MAIL;



------------------
JPD




Quote Reply
Re: Automatic e-mail notification? In reply to
Hi,
I,ve done this, but get an error in the first line, near "| |", is there any start code or something?? I'm interested in running this mod.

Thanks.
Quote Reply
Re: Automatic e-mail notification? In reply to
That's because UBB (the forum software here) puts a space between any two | characters for some reason. Take out the space between | | and it should work.


------------------
JPD





Quote Reply
Re: Automatic e-mail notification? In reply to
Thanx a lot JPDeni, it works!
BTW, as an ABSOLUTE beginner (you know..cut&paste only), where can you suggest me to look for a "gentle" introduction (very basic) to perl programming?

Thanx again!

------------------