Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function myFunction() {
- var verified=0;
- var threads = GmailApp.getInboxThreads(0, 200);
- for (var i = 0; i < threads.length; i++) {
- Logger.log(threads[i].getFirstMessageSubject());
- var messages = threads[1].getMessages();
- for(var j =0; j < messages.length; j++)
- {
- var msg=messages[j];
- if(msg.getSubject() === "Pokémon Trainer Club Activation" && msg.isUnread()) {
- var value = msg.getBody()
- .match(/Verify your email/m);
- if(value) {
- var link = msg.getBody().match(/<a href="https:\/\/club.pokemon.com\/us\/pokemon-trainer-club\/activated\/([\w\d]+)"/);
- if(link) {
- var url = 'https://club.pokemon.com/us/pokemon-trainer-club/activated/' + link[1];
- var status = UrlFetchApp.fetch(url).getResponseCode();
- Logger.log("[#] Verified (" + status + "): " + url);
- if(status == 200) { verified++; GmailApp.markMessageRead(msg);}
- }
- }
- }
- }
- }
- Logger.log("Completed " + verified + " verifications.");
- }
Add Comment
Please, Sign In to add comment