View Full Version : Administrative and Maintenance Tools - Bounced email handler
rebelde
03-30-2014, 10:00 PM
What does the bounced email handler do?
It stops sending emails to addresses that are no longer valid. This helps keep your email from being marked as spam, and helps get your legitimate emails through spam filters as a result.
More technically:
It collects emails that "bounce" (are returned to you, the sender),
Counts them and marks those accounts with lots of bounces.
It stops sending "new post" notifications to those addresses.To install:
Set up a separate email address to handle bounces, such as bounce@yourdomain.com.
(Do not use your normal email address. This modification will delete your other emails if you do!)
Upload the PHP file.
Install this plugin.
AdminCP > Settings > Options > Email Options: Set "Bounce email address" to the address in step 1.
AdminCP > Settings > Options > Bounced Email Handler: Fill in your settings
Test it:
- AdminCP > Scheduled Tasks > bounced_email_handler > Run Now to see if it is working.
- Check the email account to make sure that it is deleting the emails that it has imported.
Areas of improvement:
Find a way to stop sending other emails that shouldn't be sent such as forum subscription updates and birthday messages.
Add switch to not send PMs.
Add option to archive instead of delete emails for Gmail accounts.Please fork this add-on for VB5 and other forum software. You have my permission!
ozzy47
03-31-2014, 08:19 PM
What's the difference between this one, and this version, https://vborg.vbsupport.ru/showthread.php?t=286441
RichieBoy67
03-31-2014, 08:26 PM
What's the difference between this one, and this version, https://vborg.vbsupport.ru/showthread.php?t=286441
I believe that one had problems. This is a newer version. Not sure what is going on though with an entire new release rather than just an update to the old one.
ozzy47
03-31-2014, 08:48 PM
Yeah it makes no sense to release a new version in a new thread/mod, should have just updated the original one.
rebelde
04-01-2014, 02:17 AM
What's the difference between this one, and this version, https://vborg.vbsupport.ru/showthread.php?t=286441
The other one was an add-on to somebody else's add-on. It was a bit of a hack.
To me, this version is independent and very different and should have its own thread where people can come by and criticize it.
RichieBoy67
04-01-2014, 03:47 AM
Seems to be working for me. I altered the cron task a bit though to increase the frequency but pull less mail each time. I have a few thousand of these addresses that need to be corrected..There are over 8,000 in my mail box now so I figure a little at a time will take care of them with in a few weeks and then I can lessen the frequency.
The only thing I want is a better log because using the scheduled task log sucks. I want to know what accounts have been marked. Right now the log just shows that it polled the mail from the mail account.
Also the pm thing..I will edit the php file myself but would be nice to have it in the panel as an option.
Pretty good though and I have needed something like this for years.
Thanks!
ozzy47
04-01-2014, 09:37 AM
The other one was an add-on to somebody else's add-on. It was a bit of a hack.
To me, this version is independent and very different and should have its own thread where people can come by and criticize it.
Ahh ok gotcha, thanks for clarifying, and thanks for sharing. :)
rebelde
04-01-2014, 01:24 PM
Richie,
Thanks for testing it so quickly. The defaults were set for everyday usage. If you have a huge backlog of messages, you are going to want to do exactly what you are doing to "catch up". Once you get through the backlog, the defaults that are set make more sense.
The main table that keeps track of the bounces is beh_users. This query will show you who is being blocked:
select * from forum.beh_users where deliver_flag = '';
I've got 575 userids/emails in my list.
Let me know what you would like to see in a log and I might be able to get it added.
CharlieDelta
04-01-2014, 10:04 PM
Can this be used with DBTech's vbmail?
I was one of the users of your older mod.
rebelde
04-02-2014, 01:56 AM
Can this be used with DBTech's vbmail?
I was one of the users of your older mod.
I am pretty sure that there are no conflicts.
I have faced some problem to make it working, I have to add bounce@mydomain.com to /root/.forward my my host, also disable the firewall
working well but I have some question and suggestions
1- I have now 27 user in beh_users, so one of them , I sent mail from my forum , and its sent because the reutun is come again, thats also the same when I see bounced_count is 2,3 ... ? is it send the mail to that mail or not, if not , why I recived the bounce return again ?
2- the users in beh_users, is there any update to see them in admincp, and have user details on it and able to edit his profile ?
3- I didn't recived PM with the reports as the option config
rebelde
04-02-2014, 01:07 PM
Ezak, I'm not sure that I understand you, but I can try to answer your questions.
1. The system only stops sending emails when the bounced_count = 5 or more. Users with a bounce_count of 3 will still receive email.
2. No, there is no way to see which users are blocked in the admincp, other than running the SQL query that I posted in post 8.
3. I'm not sure what PM you expected to receive. The only PMs sent are those sent to users with 5 bounces warning then that they will no longer receive emails unless they act.
RichieBoy67
04-02-2014, 02:57 PM
working well but I have some question and suggestions
1- I have now 27 user in beh_users, so one of them , I sent mail from my forum , and its sent because the reutun is come again, thats also the same when I see bounced_count is 2,3 ... ? is it send the mail to that mail or not, if not , why I recived the bounce return again ?
Nothing will change until those users have bounced 5 times or to the amount you choose. This is because occasionally people add a vacation response or something and you do not want to change those users.
Ezak, I'm not sure that I understand you, but I can try to answer your questions.
1. The system only stops sending emails when the bounced_count = 5 or more. Users with a bounce_count of 3 will still receive email.
2. No, there is no way to see which users are blocked in the admincp, other than running the SQL query that I posted in post 8.
3. I'm not sure what PM you expected to receive. The only PMs sent are those sent to users with 5 bounces warning then that they will no longer receive emails unless they act.
perfect mod thanks
Chadi
04-25-2014, 12:27 AM
Can anyone explain how to go about cleaning over 1,000 "invalid" or "no recipient" here issues among various email services with this mod? I think 5 might be too high, maybe try at 1 or 2?
How does the mod determine what is considered a "bounce"? There are so many bounce codes to go by like 450, 451, 550, etc.
Any ideas?
rebelde
04-27-2014, 03:03 AM
Can anyone explain how to go about cleaning over 1,000 "invalid" or "no recipient" here issues among various email services with this mod? I think 5 might be too high, maybe try at 1 or 2?
How does the mod determine what is considered a "bounce"? There are so many bounce codes to go by like 450, 451, 550, etc.
Right now, the method is crude (but somewhat effective). It just counts the bounced emails, as long as they are not bounces for temporary reasons.
The different bounce codes? The current code doesn't look at them. I am hoping that one of you will take this add-on to the next level by figuring out what to do according to the bounce code. For some codes, we would stop sending email after a single bounce, while we would wait longer for other codes. I wish I had the time to do it myself, but I don't.
nick-harper
08-23-2014, 01:18 PM
How do I make bounce backs go to a different address?
rebelde
08-25-2014, 12:48 PM
How do I make bounce backs go to a different address?
Admin CP > Options > Email options > Bounce Email address
tpearl5
08-25-2014, 02:31 PM
Right now, the method is crude (but somewhat effective). It just counts the bounced emails, as long as they are not bounces for temporary reasons.
The different bounce codes? The current code doesn't look at them. I am hoping that one of you will take this add-on to the next level by figuring out what to do according to the bounce code. For some codes, we would stop sending email after a single bounce, while we would wait longer for other codes. I wish I had the time to do it myself, but I don't.
Yeah, I see a potential issue when being blocked by an entire email provider. For example, if gmail blocks you then everyone with gmail will not get emails.
Maybe in the meantime a feature to clear blocks of certain email addresses?
rebelde
08-25-2014, 02:58 PM
My experience is that Gmail and Yahoo just send your emails to the Spam folder and don't bother sending any sort of notification. Of course, different email providers can do different things, but this isn't a problem that I have run across.
If it did happen, fixing it is a simple as running the right UPDATE on the table.
UPDATE beh_users SET deliverflag = 0 WHERE email like '%@gmail.com';
Or something like that.
dknelson
11-15-2014, 01:53 PM
I used this to send emails to all the "waiting email confirmations" user group. I don't know what I did but I ended up pruning a lot of them. There are now only 44 left in that user group. Half of those though when I click on them, it says "invalid user". I can't figure out how to remove those invalid users from the user group as when I click on "delete" for that user, I get the invalid user screen. How do I remove them for the primary user list in my AdminCP?
rebelde
11-17-2014, 11:37 AM
I used this to send emails to all the "waiting email confirmations" user group. I don't know what I did but I ended up pruning a lot of them. There are now only 44 left in that user group. Half of those though when I click on them, it says "invalid user". I can't figure out how to remove those invalid users from the user group as when I click on "delete" for that user, I get the invalid user screen. How do I remove them for the primary user list in my AdminCP?
This really is beyond the scope of what this modification is trying to do. I would suggest that you try the tools in AdminCP > Maintenance > General Update Tools. One of them might fix it.
thunderclap82
03-08-2015, 03:39 PM
Is it possible to add a way to auto move a user to a usergroup if their email bounces back?
rebelde
03-09-2015, 01:10 PM
Is it possible to add a way to auto move a user to a usergroup if their email bounces back?
I can't help you, sorry, but you can edit the code if you want.
phriek
04-29-2015, 01:42 PM
I installed this mod but i use mandrill as mailprovider. I enabled an option in mandrill, which sends the bounced mails to a specific address, which works great,
But: The mails, which will be collected by the Bounced-Script via imap are only deleted and not saved to the database.
the message text of my bounced mail looks like this:
Hello, this is the mail server on mail135.atl41.mandrillapp.com.
I am sending you this message to inform you on the delivery status of a
message you previously sent. Immediately below you will find a list of
the affected recipients; also attached is a Delivery Status Notification
(DSN) report in standard format, as well as the headers of the original
message.
<user@address.com> delivery failed; will not continue trying
in beh_maillist.php i found:
// Try an alternate match
if (!preg_match('/^.*@.*$/m', $body, $matches) OR $from['mailbox'] != 'Mailer-Daemon')
This should collect the email from the mail body, right? but why it doesn't work with mine?
Thanks alot!
//EDIT
Got it to work for me. If you get the bounced mail forwarded as shown above, change the code in forum/includes/cron/beh_maillist to this:
around line 174
// Try an alternate match
if (!preg_match('/[a-z\d._%+-]+@[a-z\d.-]+\.[a-z]{2,4}\b/i', $body, $matches))
around line 186
// Valid bounced email, go!
$from = trim($matches[0]);
rebelde
04-30-2015, 02:29 PM
IMPORTANT:
I improved the plugin to do a much better job, but haven't had time to publish it here. Now, I will no longer be using vBulletin, so I'm giving you all the current code, in the hopes that one of you will take over this plugin and create a new version based on it.
The mails, which will be collected by the Bounced-Script via imap are only deleted and not saved to the database.
I suggest testing different things with the code to see what works. You might also want to test the code attached to this post.
dartho
09-25-2015, 01:52 AM
The following may be useful to someone...
// TURN OFF ALL EMAIL OPTIONS
$adminemail=$vbulletin->bf_misc_useroptions['adminemail'];
$showemail=$vbulletin->bf_misc_useroptions['showemail'];
$emailonpm=$vbulletin->bf_misc_useroptions['emailonpm'];
$receivefriendemailrequest=$vbulletin->bf_misc_useroptions['receivefriendemailrequest'];
$vbulletin->db->query_write("UPDATE `user` SET `options` = `options` - $adminemail WHERE `user`.`userid` = $userid AND `user`.`options` & $adminemail");
$vbulletin->db->query_write("UPDATE `user` SET `options` = `options` - $showemail WHERE `user`.`userid` = $userid AND `user`.`options` & $showemail");
$vbulletin->db->query_write("UPDATE `user` SET `options` = `options` - $emailonpm WHERE `user`.`userid` = $userid AND `user`.`options` & $emailonpm");
$vbulletin->db->query_write("UPDATE `user` SET `options` = `options` - $receivefriendemailrequest WHERE `user`.`userid` = $userid AND `user`.`options` & $receivefriendemailrequest");
//TURN OFF MAIL SUBSCRIPTIONS
$vbulletin->db->query_write("UPDATE `subscribethread` SET `emailupdate` = '0' WHERE `subscribethread`.`userid` = $userid;");
$vbulletin->db->query_write("UPDATE `subscribegroup` SET `emailupdate` = '0' WHERE `subscribegroup`.`userid` = $userid;");
$vbulletin->db->query_write("UPDATE `subscribeforum` SET `emailupdate` = '0' WHERE `subscribeforum`.`userid` = $userid;");
$vbulletin->db->query_write("UPDATE `subscribediscussion` SET `emailupdate` = '0' WHERE `subscribediscussion`.`userid` = $userid;");
https://vborg.vbsupport.ru/showthread.php?t=297249
ndahiya
09-26-2015, 05:49 PM
Alternatively (or in addition), the following code will change the usergroup to users awaiting email confirmation.
$vbulletin->db->query_write("UPDATE `user` SET `usergroupid` = 3 WHERE `userid` = $userid ");
ndahiya
sevenmix
09-29-2015, 02:37 PM
Sorry but... where could i find the pm text?
The one that starts something like this:
"The notification emails that the forum sends you"
Greetings
marysnow786
02-20-2016, 07:26 PM
i think it should warn users which one using fake email or temporary after Waring x days user + posts will be removed from forum it will be easy for forums databases + mailing servers i have lot many servers due to bounce rate but i fixed this issue i just migrated my forum to xenforo and install some modules deleted these users then switch back to vBulletin thanks for module anyway
khalled
03-11-2016, 06:01 PM
Test it:
- AdminCP > Scheduled Tasks > bounced_email_handler > Run Now to see if it is working.
- Check the email account to make sure that it is deleting the emails that it has imported.
i run the plug in and it working good , but i don't know what the mean of Check the email account to make sure that it is deleting the emails that it has imported
marysnow786
06-27-2016, 12:15 PM
Great module. But it will be nicer if you can display bounced emails statistics . also add options to deleted bounced users from the database and some more improvements really appricate your efforts
Nobody wants to update this? TC has given his permission in OP.
This should really be standard vb feature as sending mails to invalid addresses is really bad for your reputation in spam filter. Code needed to auto move users to new group and remove their subs was posted. So really no volunteer to improve or fix this product?
chriske
09-29-2016, 12:03 AM
I am willing to donate if needed.
I am willing to donate if needed.
I second that.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.