Gossamer Forum
Home : Products : DBMan : Customization :

e-mail adress seperated

Quote Reply
e-mail adress seperated
Hi. I'm wondering if it's possible for DBman to add all mail adresses to a seperate .txt file so that it's possible for me to use another mass-mail program.

I'm also wondering if it's possible for new users just-signed-up to receive a standard mail. I need this mail to handle usernames, passwords, real name or like, so that users get this by mail


Regards
Trond

Quote Reply
Re: e-mail adress seperated In reply to
First, you'll need to add a field for the email address of the new user to sub html_signup_form.

Then it's just a matter of adding code to add the email address to the text file and to send the email to new users. That would be in sub signup.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: e-mail adress seperated In reply to
This will pull all the emails out of default.pass (if you have them stored there) and dump them to a text file.
Could be modified to take them from the db if necessary.

#!/usr/bin/perl

# transmail.pl
$i = 0;
$txtfile = "default.pass";
$other = "/home/your_site/cgi-bin/maillist.txtl";
# Opens Text File
open (TXT, "$txtfile") or &error
("unable to open $txtfile/$_. reason: $!");
@lines = <TXT>;
close TXT;
# Create and write to the file.
open (HT, ">$other") or &error
("unable to open $other/$_. reason: $!");
foreach (@lines) {
chop;
(@address) = (split(/:/));
print HT "@address[7]\n";
++$i;
}
close HT;
&print_log;
sub print_log {
#----------------------------------------------------------
# Prints a log file to keep track of copied files.
#
print "Content-type: text/plain\n\n";
print "There were $i Email Addresses copied from $txtfile to $other.\n";
print "Check the $other to verify data transfer.";
}
sub error {
# --------------------------------------------------------
print "Error: $_[0]\n";
exit;
}

I use it with iWeb's Mailman from http://www.interactive-web.net/programs/

Bob
http://totallyfreeads.com



Quote Reply
Re: e-mail adress seperated In reply to
Thanx for the script. I've tested it out, but I can't get it working right.

I set it up like this:

#!/usr/local/bin/perl

# transmail.pl
$i = 0;
$txtfile = "default.db";
$other = "/data1/hm/nettsjekken/maillist.txt";
# Opens Text File
open (TXT, "$txtfile") or &error
("unable to open $txtfile/$_. reason: $!");
@lines = <TXT>;
close TXT;
# Create and write to the file.
open (HT, ">$other") or &error
("unable to open $other/$_. reason: $!");
foreach (@lines) {
chop;
(@address) = (split(/:/));
print HT "@address[7]\n";
++$i;
}
close HT;
&print_log;
sub print_log {
#----------------------------------------------------------
# Prints a log file to keep track of copied files.
#
print "Content-type: text/plain\n\n";
print "There were $i Email Addresses copied from $txtfile to $other.\n";
print "Check the $other to verify data transfer.";
}
sub error {
# --------------------------------------------------------
print "Error: $_[0]\n";
exit;
}

The thing is that the script finds out how many mail adresses available in default.db and tries to record them to the txt file. The problem however is that it wont. It makes out the .txt file - but it's empty


Regards
Trond-R. Bø
Quote Reply
Re: e-mail adress seperated In reply to
I think you may need to change [ 7 ] in the script to the position of the email field in your default.db.

Quote Reply
Re: e-mail adress seperated In reply to
Done that - didn't work

Regards
Trond-R. Bø
Quote Reply
Re: e-mail adress seperated In reply to
I'm not really up on some of the short-hand ways of coding, but here's how I would code part of what you have:

Code:

foreach $line (@lines) {
chomp $line;
@address = split /:/,$line;
print HT "$address[7]\n";
++$i;
}

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: e-mail adress seperated In reply to
works fine for me, both online and offline.
If its creating a blank text file, then it may be copying a blank permission field.
Try setting the field number to 0 just to see what happens. That should copy all the user names.

Bob
http://totallyfreeads.com



Quote Reply
Re: e-mail adress seperated In reply to
Also, this assumes that you have installed the password lookup mod. If you haven't, there is nothing in position 7 of the array.

JPD
http://www.jpdeni.com/dbman/