Hello.
I originally posted this Topic over in DBMAN Discussion since my main goal is to send mass email messages to users within a DBMAN database file. Carol did a wonderful job in getting me started...but I think the problems are related to general Perl problems, than with DBMAN, so I am moving the discussion here.
To see the history of this problem, go to http://www.gossamer-threads.com/...m12/HTML/000628.html
Here is what I have...A separate stand alone email script that uses information within a DBMAN file to send out email to specific users with email addresses in the database file.
Here is the script I have written (with the help of Carol and others):
&Check_URL;
open (DB, "<$db_path/$db_file_name") or ("unable to open password file. Reason: $!\n");
if ($db_use_flock) {
flock(DB, 2);
}
@lines = <DB>;
close DB;
foreach $line (@lines) {
@data = split "|",$line;
$email = $data[21];
$user = $data[3];
if (($user) && ($email)) {
my $mailer = new Mailer ( { smtp => 'yoda.coco.cc.az.us' } )
or die "Can't init mailer: $Mailer::error";
$mailer->send ( {
to => '$email',
from => '$admin_mail',
subject => 'NT Password has Expired',
msg => $notify_body_text
} )
or die "Can't send mail: $Mailer::error";
}
}
&logging;
(This is the main part of the script...the configuration variables are set-up properly and the sub-routines work fine...I thought that to save time in downloading this page, it would be best to only provide the main part of the script. Also, the path to perl is correct.)
BTW: The data fields are also correct. Field [3] is "UserName", which denotes a certain type of account that the user has in our network. Field [21] is "Email", which denotes email address of the user.
Please post your suggestions about what I need to add to this script or how I can edit this to make it work.
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
I originally posted this Topic over in DBMAN Discussion since my main goal is to send mass email messages to users within a DBMAN database file. Carol did a wonderful job in getting me started...but I think the problems are related to general Perl problems, than with DBMAN, so I am moving the discussion here.
To see the history of this problem, go to http://www.gossamer-threads.com/...m12/HTML/000628.html
Here is what I have...A separate stand alone email script that uses information within a DBMAN file to send out email to specific users with email addresses in the database file.
Here is the script I have written (with the help of Carol and others):
Code:
@referers = ('http://www.coco.cc.az.us','http://wookie.coco.cc.az.us','http://spock.coco.cc.az.us'); &Check_URL;
open (DB, "<$db_path/$db_file_name") or ("unable to open password file. Reason: $!\n");
if ($db_use_flock) {
flock(DB, 2);
}
@lines = <DB>;
close DB;
foreach $line (@lines) {
@data = split "|",$line;
$email = $data[21];
$user = $data[3];
if (($user) && ($email)) {
my $mailer = new Mailer ( { smtp => 'yoda.coco.cc.az.us' } )
or die "Can't init mailer: $Mailer::error";
$mailer->send ( {
to => '$email',
from => '$admin_mail',
subject => 'NT Password has Expired',
msg => $notify_body_text
} )
or die "Can't send mail: $Mailer::error";
}
}
&logging;
(This is the main part of the script...the configuration variables are set-up properly and the sub-routines work fine...I thought that to save time in downloading this page, it would be best to only provide the main part of the script. Also, the path to perl is correct.)
BTW: The data fields are also correct. Field [3] is "UserName", which denotes a certain type of account that the user has in our network. Field [21] is "Email", which denotes email address of the user.
Please post your suggestions about what I need to add to this script or how I can edit this to make it work.
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