Jump to content
UBot Underground

Deleting emails


Recommended Posts

What is my error guys ?

 

"Object reference not set to an intance of an object"

Loop > delete email

 

loop($list total(%emails to delete)) {
    delete email($next list item(%emails to delete))

Can someone translate this in french lol...

Thanks

 

EDITED:

 

In my %emails to delete list

I got various rows (emails) it's scrapped emails of course, then links are clicked and finally added to a list of emails to be deleted

Debugger %emails to delete list

 

(0): 0

(1): 8

(2): 21

 

Is this the problem ? My delete LOOP isn't setup right to read my %emails to delete list ?

Link to post
Share on other sites

The delete email is a command specific for emails as in the whole concept of an email, headers, from, to, subject, body txt & html, etc...

 

Like the ones you get in your Inbox...

 

The loop you coded is referring to a simple list containing email addresses, which something totally different.

  • Like 1
Link to post
Share on other sites

I still don't understand this. It's not working

 

The loop is taken from the video tutorial (video #7) starting at minute 19:30

http://www.ubotstudio.com/tutorials

So i'm wondering if there's an error in the vid ?

 

set(#row, 0, "Global") 
add item to list(%emails to delete, #row, "Delete", "Global")
loop($list total(%emails to delete)) {
    delete email($next list item(%emails to delete))
}

My

%emails to delete

list is populated

Debugger:

(0): 17

(1): 40

(2): 69

etc..

So it does get populated with only the emails that should get deleted.

 

This didn't work either

set(#row, 0, "Global")
loop($table total rows(&emails)) {
    delete email($next list item(%emails to delete))
    increment(#row)
}

Link to post
Share on other sites

This should work ?

 

connect to mail server("IMAP With SSL", "myemail@gmail.com", "password", "imap.gmail.com", 993) {
    loop($list total(%emails to delete)) {
        delete email($next list item(%emails to delete))
    }
}

%emails to delete

is already populated

Debugger:

(0): 0

(1): 8

(2): 21

etc...

 

I thought that maybe the problem was because my loop was outside "Connect to mail server" command ? But it looks like it's not the case ?

I need to delete only the emails that were used.

 

 

This doesn't work either (pop3)

connect to mail server("POP3 With SSL", "myemail@gmail.com", "whatever", "pop.gmail.com", 995) {
    loop($list total(%emails to delete)) {
        delete email($next list item(%emails to delete))
    }
}
Link to post
Share on other sites

Man am i smashing my head against the desk with this one lol !!!!!

 

Goal:

To remove emails from UB and of course from my Gmail account, just after the bot clicked on a link in the selected email. Or at the end of the hole clicking process, delete all the emails that have been worked on, leaving the un-worked ones in the account, or none related ones intacted (so it could be worked on another/later run).

I have been trying for days and can't get it to work.

 

Anyone have a logical step for doing this ?

Thanks

Link to post
Share on other sites

Ok i know what the problem is after all. The thing is, there's no way to solve this.

 

Let's say you scrap 20 emails, you then add them to a list, do your thing and then you want to flush it but by the time you are ready to flush it, another email came in thus changing the row order.

So when you scraped the email, it got position 0 but when it's time to delete it, i might be at position 2 or 3 now. So nothing works...

 

2 weeks trying to solve this. At least i'm doing other things too

Link to post
Share on other sites

  • If you connect to server using the IMAP protocol and

download the emails to a table,

as long as you loop the table within the connect to email node you are safe,

as the connection is kept alive and the emails indexing is dynamic,

so the new emails that weren't downloaded won't affect your results.

Link to post
Share on other sites

Thanks

I will try this then

 

connect to mail server("IMAP With SSL", #username, #password, "imap.gmail.com", 993) {
    create table from emails(&emails)
}
define Master Define {
define Define1 {
        set(#row, 0, "Global")
        loop($table total rows(&emails)) {
            comment("scraping verifying clicking regex etc... Commands goes here and working fine")
            add item to list(%emails to delete, #row, "Delete", "Global")
        }
        increment(#row)
    }
define Define2 {
        set(#row, 0, "Global")
        loop($table total rows(&emails)) {
            comment("scraping verifying clicking regex etc... Commands goes here and working fine")
        }
        add item to list(%emails to delete, #row, "Delete", "Global")
        increment(#row)
    }
define Define3 {
        set(#row, 0, "Global")
        loop($table total rows(&emails)) {
            comment("scraping verifying clicking regex etc... Commands goes here and working fine")
            add item to list(%emails to delete, #row, "Delete", "Global")
        }
        increment(#row)
    }
    loop($list total(%emails to delete)) {
        delete email($next list item(%emails to delete))
    }
}
Link to post
Share on other sites

Looks like it partially worked. It deleted some emails but the majority were not deleted in my gmail account.
Around 25% deletion ratio only.
I then ran the bot again to see if it was because it skipped some emails to work on at first but i got everywhere: "Link already verified"
So it did it's job on clicking links in emails alright.

I wonder why then lots of the emails weren't deleted as they were worked on ?

Wait command between each deletion ?
Man i'm so close to make this work after soooo many weeks !

If you think about something, let me know please. I am out of ideas for now.

Link to post
Share on other sites

I think I've already told you some place else or earlier, here... ALL the logic that pertains to the emails MUST be WITHIN the connect to email server NODE.

 

Like this:

 

connect to mail server("IMAP With SSL", #username, #password, "imap.gmail.com", 993) {
    create table from emails(&emails)


               <<<< ALL YOUR CODE MUST BE INSIDE THE NODE:  Here!  >>>>


}

 

Try this way, see what happens...

 

Cheers!

  • Like 1
Link to post
Share on other sites

Ok i wasn't sure i understood what you meant. I thought i was at the right place ? Anyways i will try to put it in ever closer to the mail stuff(node) by dragging the main DEFINE (master) almost into it LOL

and if it doesn't work i'll kick the mail node's ass hahahahahaha !!!!!!!

 

Man, what shitty month i'm having so far with anything i do (offline/online)

Ruff times i'm telling you !

Oh well, my bro always says:    "Life's a bitch and then you die..."

 

Thanks mate, really appreciate all the efforts !!!!!

Link to post
Share on other sites
connect to mail server("IMAP With SSL", #username, #password, "imap.gmail.com", 993) {
    create table from emails(&emails)
    MasterDefine ALL()
    loop($list total(%emails to delete)) {
        delete email($next list item(%emails to delete))
    }
}

There's something wrong for sure but i don't know how to arrange this.

Last test i did, out of the 8 emails to verify,

1) 7 were verified. It skipped one so this has nothing to do with the "deleting emails" process. Must be something i forgot on the scraping section

2) 6 got deleted overall.

3) Worst, 2 new emails came in and one of them was deleted, which wasn't suppose to be deleted of course

 

So i guess it doesn't fully respect my %emails to delete list

Rows/Position if you prefer

 

Debugger:

(0): 4

(1): 7

(2): 1

(3): 3

(4): 5

(5): 2

(6): 0

 

This one is going to be tricky and hard to troubleshoot. Maybe i just can't fully do this with UB ?

Link to post
Share on other sites

I'm not sure what your issue is, but I found at least two (2!) logic flaws in your DEFINEs, that 'might' cause an erroneous manipulation of data. ;)

 

Your code:

        set(#row, 0, "Global")
        loop($table total rows(&emails)) {
            comment("scraping verifying clicking regex etc... Commands goes here and working fine")
            add item to list(%emails to delete, #row, "Delete", "Global")
        }
        increment(#row)

The INCREMENT command is OUTSIDE the LOOP... :o

Furthermore, assuming you have corrected and added it properly inside the LOOP and now everything should work fine, there is still yet another mistake:

 

You are adding the emails to delete (the row position) WITH the Advanced option set to "Delete" which means it would delete duplicates and would only keep one single instance of multiple emails.

 

Now, if you GET multiple, identical emails from the same person (happens frequently) you are basically screwing all the indexing and your list would not reflect properly the initial table index.

 

Hope these observations would help you through the ordeal of setting the email section of your bot properly.

 

Cheers!

Link to post
Share on other sites

The INCREMENT command is OUTSIDE the LOOP... :o

 

...of course, that would matter ONLY if you would have commands inside the LOOP that would USE the indexing variable.

 

In the event you wouldn't call the list elements with $list item but use $next list item instead (as I have seen many people do) then your INCREMENT would not be needed at all, so it doesn't matter it is outside the loop anyway (does nothing) but you may have still screwed the indexing of the table:

 set(#row, 0, "Global")
        loop($table total rows(&emails)) {
.
.
.

You see, a table with 3 rows, has them indexed (numbered) as: 

  • 0 (first row),
  • 1 (second row),
  • 2 (third row)

But $table total rows(&emails) would return in this case the value = 3 (ROWS) that the table totally has..

 

That is why you should NOT loop from 0 to $max table rows, because you're gonna have an extra LOOP for a row that doesn't exist: 3 (fourth 'would be' row)

 

You should DECREMENT the $max table rows into a #MAX_Loops variable, like this:

 

set(#MAX_Loops, $table total rows(&emails), "Global")

DECREMENT(#MAX_Loops)

        loop((#MAX_Loops) {

.
.
.

 

Cheers!

Link to post
Share on other sites
  • 2 months later...

I've looked back at the video too and it does seem that connecting via pop3 is broken for deleting emails at this time. I'm talking to the dev's on it as this is important, because some mail providers, aka, hotmail do not support imap.

 

Frank

Link to post
Share on other sites

I see, thanks FRANK !

I'm still having a hard time.

 

The only solution i have found so far is to delete all emails once the job's done by login in and selecting ALL + delete

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...