Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
vBouncer : Change thread subscribtion options for members with bouncing emails Details »»
vBouncer : Change thread subscribtion options for members with bouncing emails
Version: 1.00, by tamarian tamarian is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 02-07-2004 Last Update: Never Installs: 16
 
No support by the author.

Update April 5th: Step 2A for vBulletin 3 Gold added.

What vBouncer does
vBouncer will reduce your server load, bandwidth, and your forum admin in-box, by unsubscribing members who keep bouncing their emails back to your forum admin email, which may bomb your mail box if you have a busy forum with many members who subscribe to many threads, but their emails are either invalid, inbox full, or have ISP problems.

Screen shots
None, this is a command line script, with some changes in functions.php

Who may want to use this?
1. Very busy sites, with thousands of notifications a day.
2. Your admin box gets too many bouncing emails
3. You use Postfix or Sendmail. I'm not sure how this works on other mail servers, please let me know if this works with QMail, or Exism.

Caution
This may drive some of your members mad If their email bounces a lot, this script will modify their subscriptions from their favourite threads. They will have to fix their email account, and then modify their subscribtion manually to each thread again... This may not be due to bad emails, just ISP-side problems.

Use at your own risk. I'm sharing this since some indicated interest at vBulletin.com in this thread:
http://www.vbulletin.com/forum/showt...threadid=71496
I'd be glad to help answer questions, but as with most hacks, it is your responsibility....


Installation
1. Create a unique email address on your server, dedicated to catch bouncing emails. Do not use adminemail, or any other existing email that you want to receive through a POP account. This email will be used only to catch bouncing emails.

Recommended name (makes for less editing): subscriber_notify

2. For vB 3.0.3 (older versions below, steps 2a or 2b)

I have yet to upgrade to 3.0.3, so this is contributed by ScottA:
Quote:
Originally Posted by ScottA
I got this running on 3.0.3. IIRC, what you need to do is open mail.php and look for this:

PHP Code:
    function Mail($toemail$subject$message$headers$fromemail$minusf false)
        {
            if (
$minusf)
            {
             
$this->success = @mail($toemail$subject$messagetrim($headers), "-f $fromemail");
            }
            else
            {
             
$this->success = @mail($toemail$subject$messagetrim($headers));
            }
        } 
And change it to this:

PHP Code:
    function Mail($toemail$subject$message$headers$fromemail$minusf false)
        {
            if (
$minusf)
            {
             
$this->success = @mail($toemail$subject$messagetrim($headers), "-f subscriber_notify@yourdomain.com");
            }
            else
            {
             
$this->success = @mail($toemail$subject$messagetrim($headers), "-f subscriber_notify@yourdomain.com");
            }
        } 
Note: You need to replace "subscriber_notify@yourdomain.com" with the email created in step 1.

2a. For vB3 gold
Edit functions.php

Find:
PHP Code:
       if ($vboptions['needfromemail'])
       {
         @
mail($toemail$subject$messagetrim($header), "-f $vboptions[webmasteremail]");
       }
       else
       {
           @
mail($toemail$subject$messagetrim($header));
       } 
Replace with (replace subscriber_notify@example.com with the email from step 1:
PHP Code:
   @mail($toemail$subject$messagetrim($header), "-fsubscriber_notify@example.com"); 

2b. For older, vB3 beta versions
Edit functions.php

Find:
PHP Code:
                   // send those mails
                 
if ($vboptions['needfromemail'])
                   {
                     @
mail($email['toemail'], $email['subject'], $email['message'], trim($email['header']), "-f $vboptions[webmasteremail]");
                   }
                   else
                   {
                     @
mail($email['toemail'], $email['subject'], $email['message'], trim($email['header']));
                   } 
Replace with (replace subscriber_notify@example.com with the email from step 1:
PHP Code:
                   // vBouncer hack
                 // Replace subscriber_notify email@example.com with the email from step 1
                 
mail($email['toemail'], $email['subject'], $email['message'], trim($email['header']), "-fsubscriber_notify@example.com");
                   
// end hack 

3. Copy vBouncer.pl.txt to a directory on your server above apache level. vBouncer.pl.txt is attached below.

Rename it to vBouncer.pl by typing:

mv vBounver.pl.txt vBouncer.pl

Make it executable by typing:

chmod +x vBouncer.pl

4. Edit the configuation section of vBouncer.pl
Code:
   #! /usr/bin/perl -w
   #
   # USAGE: ./vBouncer.pl -bounce : to unsubscribe threads from members with bouncing email
   #        ./vBouncer.pl : with no parameters to see (test) who will be unsubscribed
   #
   
   # Config:
   my $bouncelimit = 10;   # how many bounced emails are allowed, before taking actions
   my $downgrade = 0;      # What subscription level you will assign to bouncing members?
                           # 0 = No email, member will check subscribed thread through usercp
                           # 1 = Instant email, bad choice!
                           # 2 = Daily
                           # 3 = Weekly
   
 my $clearmailfile = 1;	# delete the mail file for bounced email when done (only deletes when -bounce option is used)
   
   my $bouncefile = "/var/spool/mail/subscriber_notify";
                           # the path/to/bouncing emails file. "subscriber_notify is the email name, you need
                           # to change it to the email name you chose for bouncing emails.
   
   
   my $db="database";        # mysql database name
   my $db_host="localhost";                # mysql host
   my $db_username="username";             # mysql username
   my $db_password="password";             # mysql password
   # end of config
5. Once a day or once a week (depending on the size of the spool size), you can run the scropt manually, or through a cron job. When done, you have to clear the email file, otherwise it will keep unsubscribing members whos emails no longer bounce.

To run the script in test mode, type:

./vBounver.pl

To run the script in bouncer mode, type:

./vBounver.pl -bouncer

To clear the mail box, use:
cat /dev/null > subscriber_notify
(or set the option in the script to do it)

Changes
Feel free to modify and post changes here or as new hacks, no credir or permission required. I may eventually add some features when I have the time.

Notes

1. The script assumes that Perl is installed @ /usr/bin/perl

If you have Perl installed elsewhere, you just need to update the first line of the script with the cirrect path:

#! /usr/bin/perl -w

2. You need to login to your server with a username that has write access to the mail spool, like a root/admin level user.

3. When run in test mode, ignore the warning "Use of uninitialized value in string eq at ./vBouncer.pl line 49" It just means you did not pass a parameter.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #62  
Old 09-08-2004, 03:22 PM
tamarian tamarian is offline
 
Join Date: Oct 2001
Location: Canada
Posts: 1,205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks ScottA. I haven't upgraded to 3.0.3 yet, so I've put your instructions into the first post.
Reply With Quote
  #63  
Old 10-12-2004, 05:05 PM
rinkrat's Avatar
rinkrat rinkrat is offline
 
Join Date: Jan 2002
Location: Long Beach
Posts: 530
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What does this mean:

[root@www cgi-bin]# ./vbouncer.pl
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .) at (eval 1) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: ExampleP, Pg, Proxy.
at ./vbouncer.pl line 80
Reply With Quote
  #64  
Old 01-01-2005, 11:55 AM
JamesFrost JamesFrost is offline
 
Join Date: Feb 2003
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Incredible idea for a script - I've been starting to do this manually for the last few weeks to try and cut down on the 100's of messages I've been getting. I was starting to think about automating this, but had no idea where to start.

can someone just clarify what this means: (I presume I can just shove it in any directory that's not in the Apache tree??)
Quote:
Copy vBouncer.pl.txt to a directory on your server above apache level.
I'll probably move users into a 'moved on' usergroup automatically as well, as I don't want people posting on my board with an invalid address. I've already got this usergroup setup, together with an automatic warning at the top indicating they have been posting with an invalid e-mail address, and asking them to correct it. Members don't seem to mind, and are generally apologetic about this. It looks like automating this will be fairly simple looking at your script.
Reply With Quote
  #65  
Old 01-01-2005, 02:00 PM
tamarian tamarian is offline
 
Join Date: Oct 2001
Location: Canada
Posts: 1,205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rinkrat
What does this mean:

[root@www cgi-bin]# ./vbouncer.pl
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .) at (eval 1) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: ExampleP, Pg, Proxy.
at ./vbouncer.pl line 80
This means you're Perl is missing some required libraries, like DBD::MySQL. You might want to install them using CPAN.
Reply With Quote
  #66  
Old 01-01-2005, 02:03 PM
tamarian tamarian is offline
 
Join Date: Oct 2001
Location: Canada
Posts: 1,205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by JamesFrost
Quote:
Copy vBouncer.pl.txt to a directory on your server above apache level.
can someone just clarify what this means: (I presume I can just shove it in any directory that's not in the Apache tree??)
Correct. It's best to not have it accessable through a browser.
Reply With Quote
  #67  
Old 01-02-2005, 11:08 AM
JamesFrost JamesFrost is offline
 
Join Date: Feb 2003
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tamarian
Correct. It's best to not have it accessable through a browser.
Script works brilliantly. Have added the following sql updates which might be useful to others :

Find :
Code:
my $qry3 = db_execute("UPDATE subscribethread set emailupdate='$downgrade'  where userid='$varname1'");
After, add :
Code:
my $qry4 = db_execute("UPDATE subscribeforum set emailupdate='$downgrade'  where userid='$varname1'");
my $qry5 = db_execute("UPDATE user set usergroupid=19  where userid='$varname1' and usergroupid=2");
qry4 cleans up any subscribed forums (instead of just subscribed threads)
qry5 moves any user who's e-mails bounce that is currently in usergroup 2 into usergroup 19.

Now I'm off to play around with Perl, and perhaps try to do some automatic e-mail processing routines (such as e-mail messages triggering forum posts! ) - What fun.
Reply With Quote
  #68  
Old 02-25-2005, 04:11 AM
slix slix is offline
 
Join Date: Jul 2004
Location: Devon, England
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This sounds cool, and is just what I have been thinking about, well almost. Problem is, I have a paying user group, and I don't want them downgraded to another group. Also will users be upgraded to their previous user group after they fix their email addy?
Reply With Quote
  #69  
Old 02-25-2005, 07:17 AM
JamesFrost JamesFrost is offline
 
Join Date: Feb 2003
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by slix
This sounds cool, and is just what I have been thinking about, well almost. Problem is, I have a paying user group, and I don't want them downgraded to another group. Also will users be upgraded to their previous user group after they fix their email addy?
qry5 above will do the downgrade on a per group basis, so wont downgrade your paying group if you dont want it to.

You cant really tell when someone fixes their e-mail, as no messages will be bounced - this would need to be done manually.
Reply With Quote
  #70  
Old 03-13-2005, 08:42 PM
T3MEDIA T3MEDIA is offline
 
Join Date: Dec 2004
Posts: 944
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

to scarry to install.
Reply With Quote
  #71  
Old 03-29-2005, 05:54 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can this be made instead to change "receive emails" from other members and admin? I am getting a load of email back from PM undelivered or other things.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:55 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06664 seconds
  • Memory Usage 2,357KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (6)bbcode_php
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete