AutoUnsub
- 8 Devlogs
- 5 Total hours
Simple gmail auto unsubscribe tool.
Simple gmail auto unsubscribe tool.
finally tested the actual unsubscribe stuff and it works, one-click requests actually go through and mailto sends the unsubscribe email through gmail smtp too. https links are still a known limitation since a 200 doesnt always mean you actually got unsubscribed, some sites need another click, but its still way better than doing all this manually. I think AutoUnsub is basically done now, just cleaning up requirements.txt and shipping
improved interactivity, added some colors and i think im ready
added sender listing and basic interactivity yay
after getting the gmail scanner and database working together, i started making the stored data easier to actually use. i added some simple database queries for listing senders, getting a specific sender and filtering down to ones that actually have an unsubscribe method. i also added tests for these queries and hit a small issue with the in-memory sqlite test database, which i fixed so the same database code works for both the real db and testing.rn the scanner can pull emails from gmail, parse their unsubscribe info, store everything in sqlite and then query the senders back out again. next i’m gonna start working towards actually doing something with those unsubscribe methods instead of just storing them.
i got the real gmail scan working, i started trying to make it faster since fetching emails one by one was taking way too long. i changed the imap scanner to fetch messages in batches instead, so it doesnt have to make a separate network request for every single email. testing it with my actual inbox showed that scanning 30 messages now takes around 2-3 seconds, which is way better than before.the weird part is the gmail connection itself is kinda messy. connecting can take anywhere from a couple seconds to 20+ seconds, but that doesn’t seem to depend on how many emails i’m scanning. rn the actual scanning is pretty fast, so i’m gonna leave the connection latency as a limitation and focus on keeping one connection alive once the main app is built.
after getting the gmail connection working i finally tested AutoUnsub against my actual inbox and got real messages comin through. the app password is now stored securely so i dont have to keep typing it every time, and the scanner is successfully pulling sender info, dates and unsubscribe headers into the format the rest of the app expects. the main problem rn is speed . scanning just 5 messages took around 30 secs, which is obviously gonna be way too slow for a bigger inbox. the current scanner fetches each message one by one, so the next commit is gonna focus on making that way more efficient .
i moved on to the database side of AutoUnsub. i added a simple sqlite database to keep track of senders, message counts, unsubscribe methods, links and statuses, then wrote tests to make sure everything was actually working. after that i started the gmail side by adding credential loading and an imap scanner that only grabs the headers we need and sends them through the parser. rn the local tests are all passing so the main pieces are comin together pretty nicely. next i’m gonna test the imap connection with my actual gmail account, because i wanna make sure the real authentication and email headers behave the way im expecting before connecting everything to the database.
so i started working on AutoUnsub, a small gmail tool that finds senders with unsubscribe options so cleaning up newsletters is a lil less annoying. i wanted to build it step by step so i could actually learn and integrate some stuff i wasnt familiar with atp, so i started with the parsing side of the project. the first commit was basically about figuring out how to read unsubscribe headers and pull out the useful information from them, including one-click post links, normal https unsubscribe links, mailto links, sender information and mailto parameters. in the second commit i cleaned that code up and simplified some of the structures so it felt less overengineered and more like normal straightforward python. i also added tests for the different unsubscribe formats and edge cases. rn the parsing part is done and the next step was to actually connect the tool to Gmail, scan messages and feed the information into the database.