Sign in to follow this  
Followers 0
Leykis101

Looping pop3 login / logout

3 posts in this topic

I am looking for a way to make my program check my email a set amount of times, every x amount of seconds. I think I have the code that should work, but I cant get it to work for some reason. It will login, check then logout once. But the second time it initiates a login, the pop3 server never responds. Can someone offer a helping hand please?

CODE
For $x = 1 to 2

_pop3Connect($MyPopServer, $MyLogin, $MyPasswd)

ConsoleWrite(@AutoItVersion & @CRLF)

If @error Then

ConsoleWrite(@AutoItVersion & @CRLF)

MsgBox(0, "Error", "Unable to connect to " & $MyPopServer & @CR & @error)

ConsoleWrite(@AutoItVersion & @CRLF)

Exit

ConsoleWrite(@AutoItVersion & @CRLF)

Else

ConsoleWrite("Connected to server pop3 " & $MyPopServer & @CR)

EndIf

$stat = ""

Local $stat = _Pop3Stat()

ConsoleWrite ( @error )

If $stat[1] <> 0 Then

_ArrayDisplay($stat, "Result of STAT COMMAND")

ExitLoop

Else

ConsoleWrite(_Pop3Quit() & @CR)

Sleep(5000)

EndIf

Next

I have attached the UDF file that contains the pop3 commands. Thanks in advance!

_pop3.au3

Share this post


Link to post
Share on other sites



hello, You've just forgotten to initialize $pop3_IsAuth and $pop3_IsConnected to "0" in the function _Pop3Quit()

Func _Pop3Quit()
    If $pop3_IsAuth = 1 Then
        $pop3_IsAuth = 0; <-------------------- here
        $ret = TCPSend ($pop3_socket, "QUIT" & @CRLF)
        If @error Then
            SetError($pop3_error_quit_refused)
            Return -1
        EndIf
        $ret = _WaitTcpResponse()
        If @error Then
            SetError($pop3_error_no_TCP_response)
            Return -1
        EndIf
        $pop3_IsConnected = 0; <-------------------- here
        
                                Return $ret
    Else
        SetError($pop3_error_no_auth)
        Return -1
    EndIf
EndFunc   ;==>_Pop3Quit
oÝ÷ ØjºÞ~éwÜZ½ëzv¬h¥j·«®â«­¢+Ø)Õ¹}Á½Àͥͽ¹¹Ð ¤(%%ÀÌØíÁ½ÀÍ}%Í
½¹¹Ñ±ÐìÐìÀQ¡¸($%Q
A
±½ÍM½­Ð ÀÌØíÁ½ÀÍ}ͽ­Ð¤($%Q
AM¡Õѽݸ ¤($$ÀÌØíÁ½ÀÍ}%Í
½¹¹ÑôÀì±Ðì´´´´´´´´´´´´´´´´´´´´¡É($%IÑÕɸÀ(%±Í($%MÑÉÉ½È ÀÌØíÁ½ÀÍ}ÉɽÉ}¹½Ñ}½¹¹Ñ¤($%IÑÕɸ´Ä(%¹%)¹Õ¹ìôôÐí}Á½Àͥͽ¹¹Ð(

bye


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0