Home/Support/Support Forum/BL2100: POP3 problems
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

BL2100: POP3 problems

0 votes
Hello,

when executing the pop3 sampleprogram parse_extra.c in order to having the SBC receive mails and delete them from the POP3 mailserver, it seems that often mails are missing.

More detailed explanation: please see below. Thanks in advance for having a look at this issue I'm dealing with!!

Noël Willems



I did build in a small loop into the sample program so the mailbox is checked every 30secs, further no modifications.

No other program is accessing the mailbox.
It doesn't happen when I perform the same with MSOutlook.

For testing and setting up this text I did send 11 mails, with the single charactar subjects a-b-c-d-e-f-g-h-i-j-k.
Chronological:

1) The first mail with subj "a" is received correctly.
2) 2nd mail with subj "b" is sent --> wait for checkkingmailbox --> no mail!
3) Try to send 2 mails before the next mailboxcheck: 3rd & 4th mail with subj "c "and "d" are missing --> no mail!
4) When I send again 2 mails before the next 30secs are passed and: these mails are received ("e"-"f").
5) "h" and "i": missing
6) "j" and "k": OK

.... see stdio output below.

When I switch of the deleting, it works better, but each time all the mails on the server are received which is not disered.

Is there something wrong with the pop3.lib? I couldn't find any mistakes concerning pop_msgcount or pop_msgnum in it, so I guess it has to do with me :-).

What could be causing this? The mailserver?

below one can find the stdio output (dynC9.62) for sending a the above mails to the SBC's mail adress.
I removed the sender's e-mail out of the text.

Resolving name...
Calling pop3_getmail()...
Entering pop3_tick()...
RECEIVING MESSAGE <1>
From: =?iso-8859-1?Q?---
To: <rabbitprocessor@mailbox.be>
Subject: a
POP was successful!
All done!
*******************************************
Resolving name...
Calling pop3_getmail()...
Entering pop3_tick()...
POP was successful!
All done!
*******************************************
Resolving name...
Calling pop3_getmail()...
Entering pop3_tick()...
POP was successful!
All done!
*******************************************
Resolving name...
Calling pop3_getmail()...
Entering pop3_tick()...
RECEIVING MESSAGE<2>
From: =?iso-8859-1?Q?---
To: <rabbitprocessor@mailbox.be>
Subject: e
RECEIVING MESSAGE<3>
From: =?iso-8859-1?Q?---
To: <rabbitprocessor@mailbox.be>
Subject: f
POP was
successful!
All done!
*******************************************
Resolving name...
Calling pop3_getmail()...
Entering pop3_tick()...
RECEIVING MESSAGE <1>
From: =?iso-8859-1?Q?---
To: <rabbitprocessor@mailbox.be>
Subject: g
POP was
successful!
All done! *******************************************
Resolving name...
Calling pop3_getmail()...
Entering pop3_tick()...
POP was successful!
All done!
*******************************************
Resolving name...
Calling pop3_getmail()...
Entering pop3_tick()...
RECEIVING MESSAGE<2>
From: =?iso-8859-1?Q?---
To: <rabbitprocessor@mailbox.be>
Subject: j
RECEIVING MESSAGE<3>
From: =?iso-8859-1?Q?---
To: <rabbitprocessor@mailbox.be>
Subject: k
POP was successful!
All done!
*******************************************
Resolving name...
Calling pop3_getmail()...
Entering pop3_tick()...
POP was successful!
All done!
*******************************************
Resolving name...
Calling pop3_getmail()...
Entering pop3_tick()...
POP was successful!
All done!
*******************************************
Resolving name...
Calling pop3_getmail()...
Entering pop3_tick()...
POP was successful!
All done!
*******************************************
asked Aug 28, 2014 in Rabbit Software by nwillems New to the Community (3 points)
edited Aug 27, 2014 by nwillems

Please log in or register to answer this question.

2 Answers

+1 vote
Make sure you are using the latest version of Dynamic C and also the latest patches. You can get both at this link

http://www.digi.com/support/productdetail?pid=5053&type=documentation
answered Aug 28, 2014 by trooper2 Veteran of the Digi Community (589 points)
Hello, thx for the quick respons.  I was using DynC 9.62, indeed without the latest patches for the lib-files.  Unfortunately updating didn't solve the problem.   It looks that there's something going wrong with the msgcount or msgnum: first mail is always received correctly.  following mails can only be received if one sends more than 1 mail between two mailbox checks.  From these multiple mails only the seoncd one & following is received, starting from message <2>... but it's not Always exactly the same behaviour...
+1 vote
You state that you modified the program. Are you still calling pop3_tick() often enough? This function services the daemon and needs to be called often.

You should be able to get more information by uncommenting

#define POP_DEBUG
answered Aug 29, 2014 by trooper2 Veteran of the Digi Community (589 points)
#class auto
#define TCPCONFIG 1
#define POP_HOST    "in.telenet.be"
#define POP_USER    "dumbanddumber"
#define POP_PASS    "dummypassword"
#define POP_DEBUG
#define POP_PARSE_EXTRA
#memmap xmem
#use "dcrtcp.lib"
#use "pop3.lib"
int n;
int storemsg(int num, char *to, char *from, char *subject, char *body, int len)
{
#GLOBAL_INIT
    {
        n = -1;
    }

    if(n != num) {
        n = num;
        printf("RECEIVING MESSAGE <%d>\n", n);
        printf("\tFrom: %s\n", from);
        printf("\tTo: %s\n", to);
        printf("\tSubject: %s\n", subject);
    }

    // printf("MSG_DATA> '%s'\n", body);

    return 0;
}

void main()
{

    static long address;
    static int retval;



    sock_init();
    // Wait for the interface to come up
    while (ifpending(IF_DEFAULT) == IF_COMING_UP) {
        tcp_tick(NULL);
    }

   pop3_init(storemsg);


do {

   costate // mailtest ivm problemen met ophalen na delete
   {
   printf("Resolving name...\n");
    address = resolve(POP_HOST);
    printf("Calling pop3_getmail()...\n");
   pop3_tick();
   pop3_getmail(POP_USER, POP_PASS, address);

    printf("Entering pop3_tick()...\n");
    while((retval = pop3_tick()) == POP_PENDING)
        continue;

    if(retval == POP_SUCCESS)
        printf("POP was successful!\n");
    if(retval == POP_TIME)
        printf("POP timed out!\n");
    if(retval == POP_ERROR)
        printf("POP returned a general error!\n");

    printf("All done!\n");
   waitfor(DelaySec(30));
   }
} while(1);

}
Forget about the text below: issue is S O L V E D: since variable n was global it's value had to be reset after each mailbox check!!!! This reset wasn't present so the message where n=num was never retrieved.

 Digging deeper into the POP_DEBUG helped finding the cause...
 So it had to do with me :-s. Sorry for that.

 Thanks!!!

Hello & thx again for your effort!  The pop3_tick() is called each loop cycle.  I added it on some extra places without result.
I activated the POP_DEBUG, then the output shows that the missing message is detected on the server: POP_READ> '+OK 1 messages' but for this particular message, no RECEIVING MESSAGE <1> occurs for some reason...
                                                                                                            
The program code can be found below followed by the stdio output with POP_DEBUG on.  Maybe it has something to do with the costate?

/* I hope it turns out a bit readable & you can find the time to have a look at it. */
...