Jump to content
UBot Underground

Forced to connect to mail server each time to delete emails


Recommended Posts

connect to mail server("IMAP With SSL", #username, #password, "imap.gmail.com", 993) {
    delete email(0)
}

 

You need to run the hole thing to delete emails. Which is connect to the mail server each time cause DELETE EMAIL will not work. Even if it's under the CONNECT MAIL SERVER and it's already connected.

 

Is there a way to arrange this ?

Link to post
Share on other sites

The connect to email server is a container node, much like an IF, a LOOP, a DEFINE etc.. so you need to have all the related code you wanna run regarding the emails, inside the container.  If you do, it will do everything with one connect...

Link to post
Share on other sites

^ This above ^ 

Same deal with connecting with a mysql database. I made the mistake a few weeks ago ago of not looking within the connect node and got locked out of my database for a good 12-16 hours 

Link to post
Share on other sites

The connect to email server is a container node, much like an IF, a LOOP, a DEFINE etc.. so you need to have all the related code you wanna run regarding the emails, inside the container.  If you do, it will do everything with one connect...

 

 

I see, then i don't understand why this isn't working ?

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

Any ideas ?

%emails to delete list

contains all the emails i want to be deleted

Debugger:

(0): 18

(1): 22

(2): 43

So it does contain the emails i want to deleted only.

 

 

EDITED:

Is it because i receive new emails in my email account before i actually start the DELETE process ? So rows aren't the same anymore ?

I just checked and by the time is has gone thru everything, i received 5 emails ?

 

If this is the case, then i need to find a way to delete the email i just worked on right away.

Link to post
Share on other sites

I have the same problem. My solution is to connect then delete. Here is an example of that process:

loop while(1 = 1) {
    set(#position, 0, "Global")
    connect to mail server("POP3", "#user name", "password", "#domain", 110) {
        clear table(&seedmails)
        create table from emails(&seedmails)
        if($comparison($email total messages, ">", 0)) {
            then {
                loop($email total messages) {
                    if($either($contains($email body text(#position), "#msg"), $either($contains($email body text(#position), "#trig"), $contains($email body text(#position), "#trig")))) {
                        then {
                            add list to list(%bouncebacks, $list from text($change text casing($replace regular expression($find regular expression($email body text(#position), "\\w\{1,\}@\\w\{1,\}.\{1,9\}?\\.(com|net|us|org|tv)"), "(\\w\{1,\}@elitepublicationshouse\\.com\\n|\\n.*)", $nothing), "Lower Case"), $nothing), "Delete", "Global")
                            increment(#bounceback)
                            save to file(#savefile, %bouncebacks)
                        }
                        else if($either($contains($email body text(#position), "Exceeded"), $contains($email body text(#position), "exceeded"))) {
                            add list to list(%bouncebacks, $list from text($change text casing($replace regular expression($find regular expression($email body text(#position), "\\w\{1,\}@\\w\{1,\}.\{1,9\}?\\.(com|net|us|org|tv)"), "(\\w\{1,\}@elitepublicationshouse\\.com\\n|\\n.*)", $nothing), "Lower Case"), $nothing), "Delete", "Global")
                            save to file(#savefile, %bouncebacks)
                            increment(#bounceback)
                        }
                        else {
                        }
                    }
                    increment(#position)
                }
                stop script
                loop($email total messages) {
                    delete email(0)
                }
            }
            else {
            }
        }
    }
    wait(#pause)
}

 

This is for a bounce back collector that stores the emails of specific bounce backs i may receive.

  • Like 1
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...