WD21 - EmailReadFirst question

Startbeitrag von Arie am 13.01.2017 19:58


I need to read message from a mailbox. Works fine using
EmailStartPOP3Session(sUser, sPassword, sAddress, sPort)
And then the default Email structureis filled with info.

After this I have to use EmailDeleteMessage() otherwise I get all the messages again the next time. Is this normal behaviour?

I also tried to use an email variable and a session
mySession is EmailPop3Session
myEmail is Email
mySession.Server = sServer

The call to EmailReadFirst returns true, but the email variable is not filled with any info. And I'm sure there;s is a message on the server.
Also when I empty the mailbox myself and restart the code above, the call to EmailReadFirst is STILL true.
What am I doing wrong here?



This is expected behaviour.

For POP3 EmailDeleteMessage() deletes the item on the server in the current session as opposed to IMAP4 which marks it for deletion and won't actually be deleted till EmailExpunge()

If you don't want to delete the items from the server you can try to request unread messages in the read mode from your EmailReadXXXXXX()

von Eric Wiegert - am 13.01.2017 22:56

that's why I tried the IMAP variant.to be able to mark the email as 'read'.
But on the exact same account the EmailReadFirst function always returns true, even if there is no email.
And if there IS an email message, the email-variable remains empty.
I must be missing a point, assuming that these functions are bugfree?

von Arie - am 14.01.2017 11:29
BTW: I tested this with a mailbox on a regular domain hosting company as well as on my clients side with an Exchange server.

von Arie - am 14.01.2017 11:31
what is the content of Email.Out when you don't have any email?

with POP3 (i don't know how imap works) EmailReadFirst returns true even when you don't have any email to read, the test must be done with Email.Out.

With POP3 you must delete the emails from the server, check the remarks of the emailreadnext function

von Paulo Oliveira - am 16.01.2017 17:23

Sorry for my late reply to your comments.

Yes EmailReadFirst() appears to return true in all scenarios I tried. But depending upon the usage (default email structure Or email variable) the corresponding email.out (email structure) or MyEmail.out (email variable) return as expected and can indicate no messages found.

If you have control over the email box your connecting to then you can do either pop3 or imap4 and retrieve/read/delete the messages at will.

If you don't have control of the email box (can't rely on the accuracy of the "unread" status of messages on the server) then you will need to download all process and delete to keep the server list small.

von Eric Wiegert - am 16.01.2017 17:27

Re: WD21 - EmailReadFirst question SOLVED

Paulo, Eric,

I already use the Email.Out and myEmail.Out with no luck. But the cause of my problem was elsewhere.
Yes, it turned out to be my AVG anti virus scanner. Disabling the email-security made the WD app run as expected. Still somewhat strange as Outlook handled IMAP without any problems, which I tried in the first place to see if my settings where okay.

Thnx for the input

von Arie - am 17.01.2017 08:00
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.