The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Need help writing an SQL query to remove bounced emails
Hi,
I have a list of bounced emails, and I want to change the receive admin email option to "no" for these users, by running an update query on the user table. I understand, I can change those options with this part: UPDATE user SET options = options - 16 WHERE options & 16 AND userid = xxxx However... I'm having a hard time coming up with the query to cross-reference the bounced email list. I figure I can import the bounced emails to a table called, "bounce" and essentially, I want to UPDATE user (like above) WHERE bounce.email = user.email however... it's not that easy (for me) - maybe there's some mysql experts that could point me in the right direction? |
#2
|
|||
|
|||
Maybe something like this:
Code:
UPDATE bounce LEFT JOIN user USING (email) SET options = options - 16 WHERE options & 16 Maybe you could even add a column to your bounce table and set it so you know which ones matched. |
#3
|
||||
|
||||
Cool... It works, except I want to update "user" and LEFT JOIN bounce
Thanks! |
#4
|
|||
|
|||
I'm not a MySQL expert, but I think if you "left join bounce" you get a table with every user, but the columns from bounce will be blank unless there's a matching email. So you'd be resetting the options of every user (I think).
|
#5
|
||||
|
||||
Actually, as I investigate further... this isn't what I want to do anyway. Changing the Admin Emails to "no" doesn't do what I want...
Basically, I have a list of all of the bounces from our database - there's a lot as we have more than 200,000 users in our database. I want to set it so that bounces don't get subscription notifications or other emails at all anymore, as there are thousands of bounces weekly. Not sure what to do here. |
#6
|
|||
|
|||
Yeah, what you need to do is delete all the records with the matching userids from the tables subscribethread, subscribeforum, subscribeevent, subscribegroup, and subscribediscussion. But one issue is that if someone's email bounces temporarily or if they just didn't get around to updating their new email or something, doing that will erase all their subscriptions.
|
#7
|
||||
|
||||
Hmm... sounds even more difficult.
What if I just remove their email addresses from the database, and limit the actions to users who have no activity in over 2 years (or something like that). |
#8
|
|||
|
|||
Yeah, removing the email is an interesting idea. If it's bad it doesn't matter, and a user can always just re-enter it. I don't know what else might happen if you just deleted the value from that field, but you could try it.
|
#9
|
|||
|
|||
Could cause problems leaving that field blank. Have you checked for any plugins for bouncing emails I am sure there are some around
|
#10
|
||||
|
||||
Code:
UPDATE user LEFT JOIN bounce USING (email) SET user.email = '' WHERE bounce.email <> ''; Thanks for the help. Quote:
Thanks. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|