Gossamer Forum
Home : Products : DBMan : Customization :

Subscribe DBMan emails to listserve

(Page 1 of 2)
> >
Quote Reply
Subscribe DBMan emails to listserve
I'm running Eliot's Mass Emailer v 2.1. It works great, so long as I don't exceed my ISP's limit of 50 at a time. With that, I purchased list-serve (from my ISP), to try to send the 250+ that have indicated Yes in the ReceiveEmail block of the script.

Unfortunately, I get cannot find server error, while it's executing. I asked the question of my ISP, they're reply ...
Quote:
... you need to take all the email addresses from your database and
subscribe each one to your listserve. To simplify the process, you can write a script
that will cycle through your database and subscribe each email address.
Any suggestion's on how to do this?
JR


------------------
Joebagodonuts, JR or Anita
http://home.flash.net/~murgnam/
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
What do you have to type from a shell prompt in order to subscribe a single email address to the listerve?

With that, you can write a short script that checks each record to check if ($rec{'receiveEmail'} eq 'yes'), and grab the email address if it does and execute a subscription request to the listserve.

Something like that would work great if you are processing a bulk database. You might want to add a routine similar to that for when a user indicates yes in the receiveEmail block, and sends an unsubscribe if they change it to no later on. That'll make it easier to process new users to the list.

--Lee
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
Lee,
DBMan I'm beginning to get the hang of, writing scripts, and now list-serve are foreign to me. If I understand yr question right, the below is what folks would have to do to subscribe
Quote:
To be added to your list, a user simply sends a message to majordomo.
There are two ways to do it:

address-- To: database-news-you-can-use-request@majordomo.flash.net
message-- subscribe

OR

address-- To: majordomo@majordomo.flash.net
message-- subscribe database-news-you-can-use
Does that help or hurt?
JR

Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
It helps, actually.

What you'd want to do is write a short script that checks each record to check if $rec{'receiveEmail'} eq 'yes'), and grab the email address if it does. Then using sendmail, send the email for the user automatically.

Another way to do it is whenever a user specifies they want to subscribe to the list, a subscription email should be sent out immediately:

Code:
open (MAIL, "$mailprog") or &cgierr("Can't open sendmail!\n");
print MAIL "To: majordomo@majordomo.flash.net\n";
print MAIL "From: $rec{'email'}\n";
print MAIL "Subject: subscribe\n\n";
print MAIL "subscribe database-news-you-can-use\n";
close (MAIL);

a nice thing to also include would be an unsubscribe option:

Code:
open (MAIL, "$mailprog") or &cgierr("Can't open sendmail!\n");
print MAIL "To: majordomo@majordomo.flash.net\n";
print MAIL "From: $rec{'email'}\n";
print MAIL "Subject: subscribe\n\n";
print MAIL "unsubscribe database-news-you-can-use\n";
close (MAIL);

Does that help?

--Lee

[This message has been edited by leisurelee (edited April 12, 2000).]
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
Lee,

It helps how you explain what I want to do -- which I think is exactly on target.

The problem is how do I encorporate? I don't think yr talking about a stand-alone script. Guessin' I need to encorporate something like in have in sub html_add_success, like the below?
Code:
sub html_add_success {
# --------------------------------------------------------
# The page that is returned upon a successful addition to
# the database. You should use &get_record and &html_record
# to verify that the record was inserted properly and to make
# updating easier.

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

open (MAIL, "$mailprog") or &cgierr("Can't start mail program");
print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: Record Added\n\n";
print MAIL "-" x 75 . "\n\n";
print MAIL "The record on a $rec{'First Name (Nickname) & Spouses Name'} $rec{'Last Name in School'}/$rec{'Married Name'} $rec{'YearGrad'}
has just been updated. Modify or Upload as necessary.";
close (MAIL);

&html_print_headers;
print qq|
<html>
<head>
<title>$html_title: Record Added.</title>
</head>

<body background="http://home.flash.net/~murgnam/S2.JPG">
<center>
<table border=1 bgcolor="#FFFFFF" cellpadding=5 cellspacing=3 width=500 align=center valign=top>
<tr><td bgcolor="navy">
<FONT FACE="MS Sans Serif, arial,helvetica" size=1 COLOR="#FFFFFF">
<b>$html_title: Record Added</b>
</td></tr>
<tr><td>
<p><center><$font_title><b>
Record Added
</b></font></center><br>
<$font><P>The following record was successfully added to the database:</FONT>
|;
&html_record(%rec);
Below is my feable attempt ... but an attempt nonetheless, :-0
Code:
sub html_listserve {
# --------------------------------------------------------
# The page that is returned upon a successful subscription to
# listserve. You should use &get_record and &html_record
# to verify that the record was inserted properly and to make
# updating easier.
%rec = &get_record($rec{'Receive Email'} eq 'Yes');
open (MAIL, "$mailprog") or &cgierr("Can't open sendmail!\n");
print MAIL "To: majordomo\@majordomo.flash.net\n";
print MAIL "From: $rec{'Email Address'}\n";
print MAIL "Subject: subscribe\n\n";
print MAIL "subscribe database-news-you-can-use\n";
print MAIL "-" x 75 . "\n\n";
close (MAIL);

&html_record(%rec);
}
OK, that took me 30 minutes to "attempt" to write. Note I changed to "Email Address" as that's how it looks in default.cfg. Also left in the "print MAIL "-" x 75 . "\n\n";". Don't know if that 2nd part is important, but what the hey. Also, I'm not sure whether I should or shoulda put in the %rec thing, but I'm hoping that's what you were talking about earlier.

OK, I'm sure I prob butchered the above, but I tried. Other question, with the above I'm assumming I need to put something in db.cgi to call the sub html_listerve?

If I can wicker the above, that's great! But, I'm seeing it as only working for those who subscribe from this point on ... what about the 250 folks I already have, who've indicated Yes in the Receive Email area? How do I pull them in?

So far as the unsubscribe part, don't think I need that -- as I'm only concerned and wanting to send my database news you can use Newsletter thingy to the folks that indicate Yes. So long, as the folks indicating No, don't get their email address pulled in to the listserve, all is well.

JR

[This message has been edited by joebagodonuts (edited April 12, 2000).]
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
Let's work on one thing at a time -- adding new people to the listserv. We can get to adding your other 250 in a bit.

What I would do is add the mail to the listserv right after the mail to the admin:

Code:
%rec = &get_record($in{$db_key});
open (MAIL, "$mailprog") or &cgierr("Can't start mail program");
print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";
etc.
close (MAIL);
if ($rec{'Receive Email'} eq 'Yes') {
open (MAIL, "$mailprog") or &cgierr("Can't open sendmail!\n");
print MAIL "To: majordomo@majordomo.flash.net\n";
print MAIL "From: $rec{'Email Address'}\n";
print MAIL "Subject: subscribe\n\n";
print MAIL "subscribe database-news-you-can-use\n";
close (MAIL);
}
&html_print_headers;
print qq|
<html>
<head>
<title>$html_title: Record Added.</title>
</head>
etc

It wasn't a bad attempt. Just needed some tuning. Smile


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






Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
JPD, you took the words right out of my keyboard. Smile

--Lee
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
WOW!!! My preliminary tests on a dummy database work perfectly! Those who leave "Yes" in the Receive Email Block of the database get the Welcome emails from listserve -- as do I, the admin, seeing who's subscribed. I further tested by indicating "No", and they didn't get subscribed, which is the intent, :-)

To step 2 tho'... the current 250+. I'd rather the subscription be transparent, rather than each subscriber getting an email stating their subscribed to some listserve thingy -- I fear they'll become more confused. If it can't work that way, that's fine ... just a thought.

Over

JR

[This message has been edited by joebagodonuts (edited April 12, 2000).]
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
I bet that there is a toggle in the majordomo program that turns off email notification. I would temporarily turn off the email notification then manually add the 250 users to your majordomo database.

Then turn the email notification back on.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
Eliot,
I think yr right, I saw
Quote:
# welcome [bool] (yes) <majordomo>
# If set to yes, a welcome message (and optional 'intro' file) will
# be sent to the newly subscribed user.
welcome = yes
in my listserve config. I'm guessin toggling that to no is what yr referencing?

Sure would be nice to NOT have to MANUALLY subscribe the 250+ tho', ACK!

JR
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
Yes...that is what I mean...You set that variable to no...

And I really don't know of any other method.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
You say that you can only send 50 records at a time through the mass mailer, right? And you want to go through your database and find the folks who want to be on the mailing list and subscribe them to the list.

So you need some way to break up the list of email addresses into blocks of 50.

I'm sure you could use a script to look through the .db file for users with the 'ReceiveMail' flag set and write only 50 records to an external file. When it reached 50, it would start a new file. Then you could point the mailer at each file. You would have to manually edit the mailer each time to change the name of the file, but editing the mailer 5 times would be easier than manually sending 250 emails.

I'm not that familiar with majordomo. Is there any way that you can just add a list of addresses to the list directly? Then all you'd need to do is have a script to pull out the email addresses and you could paste it into the file that holds the addresses to the majordomo subscribers.

I don't know if this is possible or not.


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






Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
I would imagine it would be more adventageous to write a temporary bit of code, maybe even a seperate cgi script entirely, that goes through the db file when it finds someone who should be on the list, it sends an email out right then and there. So you wouldn't have to make a seperate list, nor would you have to incorporate a one-time used code into your db.cgi file. (Unless you intend to resubscribe your entire database to your listserve on a regular basis...) I'm thinking this wouldn't have anything to do with the mass-mailer MOD at all. You're going to be doing a mass-mailing to the listserv, but not the kind of mass mailing that it was designed for. Smile

--Lee

[This message has been edited by leisurelee (edited April 12, 2000).]
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
I was thinking of a separate script -- not anything within db.cgi. (The mass mailer is a separate script, too.) The problem with your idea, as I understand it, Lee, is that his server balks after sending 50 emails in a row.


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






Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
Let me try to capture what I'm against.

1. Eliot's 2.1 works great for my purposes, cept my ISP states,
Quote:
if you are using our outgoing mail server you may only send up to 50 recipients per single email and must be logged on to one of our access
numbers to do so.
you may call customer care to purchase list serve if you wish to maintain a list to which recipients may subscribe/unsubscribe

2. I now have listserve. With JPD's earlier hack of my sub html_listserve, subsequent additions to my database, indicating Yes in the Receive Email block, will be successfully subscribed to my majordomo list.

3. The boggle is the transparent transfer of the existing 250+ folks currently indicating Receive Email -- without having to bother them with a subscription to listserve they didn't necessarily know they were subscribed to.

So ... my options:

1. Emplore yr help in finding a way to import said email addresses into my listserve -- even if it's only a one time script.

2. Toggle the welcome, and painstakingly manually update the aforementioned 250+.

3. Break the db into 50s and edit the mailer files in those blocks of 50s.

NOTE: Eliot ... correct me if I'm wrong, but v2.1 uses the web form -v- the earlier version edit of the cfg file each time, e.g., how would the break up work on the v2.1 verson ... or should I revert to the earlier version, where I could edit the cfg.

Ugh. I "thought" listserve was my workaround, but appears it's gonna be painful, whether on me or yall. I'm at a loss, :-0.

I know this reply is prob redundant, but was trying to capture it ... discuss, if possible.

JR
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
Doesn't the mass mailer send out individual emails? From what your sysadmin said, the problem is sending an email with more than 50 addresses within the one mail. But it looks like the mass mailer opens the mail program, sends the email, closes the mail program and then gets another address.

Have you had problems sending more than 50 emails at a time?


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






Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
Yes, I get cannot find server error. Here's the audit trail w/FlashNet,
Quote:
If you are trying to send all 222 emails simultaneously, then the server is
probably timing out while trying to verify all the various domain names. I
would recommend cycling through your database and only sending 10 emails at a
time. This method is actually more effective and will process the emails more
quickly.

Regards,

"Joebagodonuts, JR or Anita" wrote:

I have a CGI database, where from time to time I need to email the folks (222 so far) on news/updates/revisions to the database and our reunion cause. The last two times I tried, the server timed out. I'm "guessing" there's a max # of addressees the caligula@flash.net address/server will accept. Do I need to "somehow" modify my script to only send X number of emails?
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
Now I got it. Smile (I'm a bit slow sometimes.)

The only idea I have for sending a few at a time is what I said before -- creating a series of files of email addresses and using those to send the "subscribe" email.

I did ask my gurus about subscribing people "en masse." I'll let you know if I an answer you can use.



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






Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
I heard back from my gurus.

This was my question:

Quote:
This is for someone else who is setting up a majordomo mailing list. Is there a way to subscribe users en masse by just sending one email or appending the addresses to a file? Or does each one have to be subscribed separately?

This is from the first guru:

Quote:
Yes, you can do either. You can do them all in one message (with the approve password) or you can just add them to the list file. Adding to the list file is probably easier if you have write permission to it, but they won't get the 'welcome' message or anything. They'll just be silently added.

and this is from the second one

Quote:
If the person has write access to the majordomo configuration stuff, there will be a file in that directory which is simply a list of all the subscribers. Appending to that file will effectively subscribe everyone automatically. I think there's a way to do it through the email interface, but it's been too long since I've been a majordomo list manager.

So, it appears that, if you pull all the email addresses into one file, you can then either append the file to something within majordomo or copy the file into one email message and have all of the people added at once.

I'd check again with the sysadmin to see if this is possible on your system.


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






Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
JPD,

Think yr "guru's" were right on target! After "reading" thru the 30 someodd pages of drivel in the majordomo program email I received, I found the below:
Quote:
You aren't limited to approving only things to Majordomo requests approval for. You can approve any "subscribe" or "unsubscribe" request, regardless of whether Majordomo has requested this approval, with an "approve" command. Thus, you can subscribe or unsubscribe people from your list without them having to send anything to Majordomo; just send an appropriate "approve PASSWORD subscribe LIST ADDRESS" or "approve PASSWORD unsubscribe LIST ADDRESS" command off to Majordomo.

If you use a mailer which is capable of sending a message to an external program, can run perl and can run sendmail or a program capable of behaving like it for the purposes of sending mail, then all you have to do is send the entire approval message (including all of the headers, which are very
important and which are automatically removed by some mailers unless configured to do otherwise) to the approve script. Approve looks for a file called ".majordomo" in your home directory to find the approval
password for your list.
So, with the info from the 1st para above, I'm gonna try to close this saga (thinking I can't be the only one that wonders how to encorporate DBMan with majordomo), and provide what it "should" take for me or others to get this to work ...

1. Encorporate yr above hack to sub html_listserve for subsequent records to be automatically subscribed -- provided, like in my case, they indicate Yes in the Receive Email block.

2. Toggle majordomo to NOT send the Welcome letter to those already subscribed.

3. Painstakingly send a
Quote:
approve <passwd> {subscribe|unsubscribe} <list> <address>
command to majordomo for each email address you want subscribed.

NOTE: I'm hoping it won't be that difficult. If I use use Mitch's Excel Mod to pull those indicating Yes, I should then just have to cut|copy|paste the column of email addresses into the above command.

4. Toggle the Welcome letter back to yes.

That "should" do it, I "think", :-0. But as a sidebar, check out the 2nd para above, where it talks about "If you use a mailer ...". What does that mean in plain english?

So ... am I "now" on target myself?, so we can close this !@#$ thing? Ugh.

JR
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
I think you're on the right track. As long as new users are able to get on the listserve without you having to add them manually, the other 250+ may take some doing but it will only be a one-time hastle. Smile

--Lee
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
OK, I've encorporated everything above, toggled the welcome back and forth, painstakingly approved the current 245 subscriber's.
Unfortunately, after this practical application, I now find that I should prob put in something for the unsubscribe part. I don't think I can put in two if statements like the below ... or can I? Some else or elsif statement perhaps?
Code:
%rec = &get_record($in{$db_key});

open (MAIL, "$mailprog") or &cgierr("Can't start mail program");
print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: Record Added\n\n";
print MAIL "-" x 75 . "\n\n";
print MAIL "The record on a $rec{'First Name (Nickname) & Spouses Name'} $rec{'Last Name in School'}/$rec{'Married Name'} $rec{'YearGrad'}
has just been updated or the Yes block in Receive Database News You Can Use from Webmaster has been checked. Modify or Upload as necessary.";
close (MAIL);
if ($rec{'Receive Database News You Can Use from Webmaster'} eq 'Yes') {
open (MAIL, "$mailprog") or &cgierr("Can't open sendmail!\n");
print MAIL "To: majordomo\@majordomo.flash.net\n";
print MAIL "From: $rec{'Email Address'}\n";
print MAIL "Subject: subscribe\n\n";
print MAIL "subscribe izmir-database-news\n";
close (MAIL);
}
if ($rec{'Receive Database News You Can Use from Webmaster'} eq 'No') {
open (MAIL, "$mailprog") or &cgierr("Can't open sendmail!\n");
print MAIL "To: majordomo\@majordomo.flash.net\n";
print MAIL "From: $rec{'Email Address'}\n";
print MAIL "Subject: unsubscribe\n\n";
print MAIL "subscribe izmir-database-news\n";
close (MAIL);
}
This should only happen when someone modifies their record changing from Yes to No.

JR

[This message has been edited by joebagodonuts (edited April 14, 2000).]
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
Looks good, in theory. Smile

You might want to change your "no" check from an if to an elsif. That way if it equals yes, it won't run the "if no" check. Saves a little CPU time, nothing major, but it is a good idea.

I think you might also have to close MAIL after each message, and re-open it for the next. I'm not positive, though. If it gives you any grief, try doing that.

One thing I did also notice in your code. Your email to the admin will ALWAYS say "so-and-so just subscribed" even if they are unsubscribing. You might want to modify that a little to indicate which they're doing.
--Lee

[This message has been edited by leisurelee (edited April 14, 2000).]
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
Lee,

I changed the 2nd if to elsif. I also "think" the code I referenced above "did" close after each MAIL. So far as the admin email, yeah I know -- it's just for my eyes, I'll get to that a later date.

But, with this latest addition, I put the database to a test. Adding a record indicating Yes, works like a charm -- subscribes me.

However, modifying to change to No, does NOT "unsubscribe", like I want. I'm wondering whether I need to further put something in db.cgi (sub main) to include if ($per_mod) or something like that?

JR

[This message has been edited by joebagodonuts (edited April 14, 2000).]
Quote Reply
Re: Subscribe DBMan emails to listserve In reply to
Unsubscribing might be a little tougher. But I'm not sure. Smile

You have added the mail to the listserver in sub html_add_success, right? If you want to send another email after the user modifies the record, you'll need to add the routine to sub html_modify_success -- except that, by the time the script reaches that point, the original values will be lost.

You'll probably have to add code to sub modify_record in db.cgi, but that's going to be tricky, too.

I know the code will go just before

$output .= &join_encode(%in);

but I'm not sure right now what the code will be. I'll have to ponder it for a while. Smile


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






> >