Gossamer Forum
Home : Products : DBMan : Customization :

Ask for sub for email notify

Quote Reply
Ask for sub for email notify
Hello all,

I want setup the sub for email notify.
Every add, modify and delete record will send email to own by default.pass email address.

Thx

Gab

------------------
Quote Reply
Re: Ask for sub for email notify In reply to
http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/000454.html

is this what u want?
Quote Reply
Re: Ask for sub for email notify In reply to
Who do you want to send the email to?

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





Quote Reply
Re: Ask for sub for email notify In reply to
Hello JP!

it's me again and i am bugged with a new problem. I need to email one of the users (e.g. myself@domain.com) should there be any modification, addition or deletion of record in my database. Ive read ezkimo's posting but i do not have a sendmail running in my server. this is an nt server, by the way. but i managed to download perl script and module at www.tneoh.zoneit.com/perl/Sendmail. the question is, how would i integrate those files now? moreover, the email body shld contain the various fields of the record and have as the subject the thing done to the record (modified, deleted or added).

please help me again.
Quote Reply
Re: Ask for sub for email notify In reply to
I don't know how to use sendmail if it isn't provided by your server. My "thing" is Perl programming. Smile

Once you get it worked out, sending the values of the fields won't be a problem. The only thing you might possibly want that I don't know how to do is to send the value of pre-modified fields or which fields were modified. But sending you the entire record is a piece o' cake.

As soon as you have sendmail up and running, I'll be glad to help you out.


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





Quote Reply
Re: Ask for sub for email notify In reply to
Hello,

Could you use SMTP and sockets to send the mail? Check out the scripts at Big Nose Bird.
http://www.bignosebird.com

Bruce has scripts that send mail that you can use with sendmail or a SMTP server and sockets.

On an NT machine there is a program called BLAT.EXE that I think will send mail. Anyway check the BNB for examples of this.

Thanks
Quote Reply
Re: Ask for sub for email notify In reply to
Can you use sockets or SMTP? Probably. I just don't know how.


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





Quote Reply
Re: Ask for sub for email notify In reply to
You can use mailer.pm module in LINKS program that will allow you to send messages via sockets/SMTP rather than Sendmail.
We have this working with DBMAN on our NT Server.

If you want further instructions on how to set this up, let me know.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Ask for sub for email notify In reply to
I would like to know if there is a way to send a confirmation message to registered users every time they add, felete, or modify a record. I have read through various threads in this forum, but there is no direct answer for this challenge. I thought this thread was the most appropriate.

Basically, what I am looking for is a way to automatically send an email message to the record owner, not an administrator or data manager.

I have tried the following:

1) Inserted these codes into the add_record, modify_record, and delete_record sub-routines:

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

2) Then in the "sendmail section",I've added these abridged set of codes:

Code:
open (MAIL, "$mailprog") | | &cgierr("unable to open mail program");
print MAIL "To: $rec{'Email'}\n";
print MAIL "From: $webmaster\n";
close (MAIL);


I have added these codes after the call for the success sub-routine, such as &html_modify_success;.

No message is sent to the record owner. I apologize if this is a cross-posting, but the other Topics that I read did not answer my question.

I know that I may have to insert these codes:

Code:
open (PASSWD, "<$auth_pw_file") &#0124; &#0124; &cgierr("unable to open password file. Reason: $!\n");
@passwds = <PASSWD>; close PASSWD;

but I don't know exactly how I would code the cgi script to send a message to the record owner.

Any help would be greatly appreciated.

TIA.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited August 01, 1999).]

[This message has been edited by Eliot (edited August 01, 1999).]
Quote Reply
Re: Ask for sub for email notify In reply to
I guess the most obvious question is whether you have a field called Email in your database.

If not, and you have a userid field and you are using the password lookup mod, you'll need to use the password file for the email address.


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





Quote Reply
Re: Ask for sub for email notify In reply to
I did get the new password lookup mod to work (with the exception of the change email and password sub-mods). I do have an 'Email' field.

How do I appropriate use the password file to send emails to record owners?

TIA.



------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Ask for sub for email notify In reply to
Code:
open (PASSWD, "<$auth_pw_file") or &cgierr("unable to open password file. Reason: $!\n");
@passwds = <PASSWD>;
close PASSWD;
foreach $pass (@passwds) {
if ($pass =~ /^$db_userid:/) {
@data = split ":",$pass;
$email = $data[7];
last;
}
}

Then use the variable $email for your "To:" line in the email message.


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





Quote Reply
Re: Ask for sub for email notify In reply to
Hmm....didn't work. I'll play around with it some more. Logically speaking, the codes you've provided should work...but no go.

Thanks.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Ask for sub for email notify In reply to
You might try doing some debugging by printing out values of $pass and @data[7].



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





Quote Reply
Re: Ask for sub for email notify In reply to
I tried using a print statement in the following fashion:

Code:
open (PASSWD, "<$auth_pw_file") or &cgierr("unable to open password file. Reason: $!\n");
if ($db_use_flock) {
flock(PASSWD, 2) or &cgierr("unable to get exclusive lock on $auth_pw_file.\nReason: $!");
}
@passwds = <PASSWD>;
close PASSWD;
foreach $pass (@passwds) {
if ($pass =~ /^$db_userid:/) {
@data = split ":",$pass;
$email = $data[19];
last;
}
print PASSWD "$userid:$encrypted:$view:$add:$del:$mod:$admin:$email\n";
}

Still doesn't work. *scratches head* Hmm...well, back to the drawing board. A potential problem with using these codes is that if it works, it will only send an email message if an email address is provided in the database file.

Still need to find a way to pull the $email variable from the password file to send an email to the record owner regardless if they enter an email address in their record...
Ain't Perl fun! Smile

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited August 02, 1999).]
Quote Reply
Re: Ask for sub for email notify In reply to
Your line

print PASSWD "$userid:$encrypted:$view:$add:$del:$mod:$admin:$email\n";

won't give you anything. None of the variables except "$email" have been defined, your syntax is for printing to a file and the file has already been closed.

Where did you get the "19" in

$email = $data[19];

If you are using the password file, the email address is at $data[7].


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





Quote Reply
Re: Ask for sub for email notify In reply to
Carol,

Thanks! It worked...finally. I was taking 19 from my database file as the Email address field. After looking at the codes more carefully and your response, I realized that was the problem. I set the $email back to 7.

One bug occurred in the email header....

Code:
Date: Tue, 3 Aug 1999 02:01:12 -0400 (EDT)
From: Unprivileged user <nobody@www21.web2010.com>
To: eliot@anthrotech.com

I have never seen "Unprivileged user" come up in an email header. It is something that I probably have to take up with my ISP. Very strange though, since this header does not appear in other email mods I have installed in this particular DBMAN project.

But, thanks for your assistance...again, I appreciate it a lot.

Smile

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us