LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with mail browser

Trying to retrieve e-mail using the mail browser vi provided on this web site. Although the mail from the pop server is downloaded, and message summary indicator shows that the messages have been downloaded(and the number of messages is also shown correctly), the message array is empty. Any help is greatly appreciated.
0 Kudos
Message 1 of 12
(3,347 Views)
Belur,

I wrote that example when I was an Applications Engineer for NI to teach myself about POP3, and I've felt guilty ever since that it is such an incomplete implementation. The header parsing, error handling, and lots of other stuff is not anything close to what you'd call production code.

That said, I'm baffled at your problem description. As far as I know, the actual capture of the mail body text is pretty bulletproof. Could you give a screenshot, or describe the problem again being sure to use actual VI names and terminal names from the example? Also describe any results you get when you probe for data that you expect to see in various places on the diagram.

I'm sure I can help you get the basic functionality going if you can tolerate the limi
tations of the example. If you're really looking for a full and robust solution, you might consider trying another implementation or researching to see if there are any good not-100%-LabVIEW solutions (e.g. ActiveX, external libraries, etc.).

Best Regards,
John Lum
National Instruments
Message 2 of 12
(3,347 Views)
John,

Thanks for your prompt response. Here are some details and a screen shot of one of the sub-VI's namely Get All Messages.VI. The main VI MailBrowser.vi just hangs and when I try to highlight execution I noticed that it is hanging in the Get All Messages.vi and I have captured the screenshot and attached here.

I have used this tool before(2-3 years ago) successfully myself and found it useful for my application. If I can get it to work now again (with any pop server) that is good enough for me. I am developing an information assurance simulation model in which the mail utility is just a small part.

Many thanks for your help.

Sheela
0 Kudos
Message 3 of 12
(3,347 Views)
John - Here's some more information for you:

CHK POP MAIL sub VI returns no error which is an input to RETR POP MAIL sub VI . But RETR POP MAIL sub VI shows an error code of 56 at both error in and error out. I am not able to understand how the input error code can be 56 which should have been nothing but the output error (code 0) of CHK POP MAIL.
0 Kudos
Message 4 of 12
(3,347 Views)
Sheela,

In your case, the error is happening in one of the 48 iterations (presumably the first one) of the RETR POP MAIL subVI in the For Loop of Get All Messages, and that error is getting passed to subsequent iterations of that subVI. That's why you see an error on both the input and output side when all the iterations are done, even though there isn't any error passed initially from CHK POP MAIL.

Error 56 is a timeout error that is happening either because the TCP Reads aren't happening as fast as expected, or because (in my non-robust implementation) the mail text body is not broken up with any CRFL characters at least every 1,000 bytes, or for various other reasons. Timing and handshaking can be very tricky with TCP communication.


To really resolve the problem here would involve rewriting the "POP Read to DOT-CRLF" subVI in a more robust way that doesn't depend on seeing any CRLFs in the mail body, but only the final PERIOD/CRLF sequence that signals the end of the message.

Otherwise, some quick and dirty suggestions are:
- Try increasing the hardcoded TCP timeout inputs, especially in the POP Read to DOT-CRLF subVI. I actually doubt this alone will work, but...
- Increase the Bytes to Read input in POP Read to DOT-CRLF to some fairly large number. Maybe 250000 or more.
- Modify the code to ignore Error 56
- Modify the code to ignore all errors

Hope that helps,
John
0 Kudos
Message 5 of 12
(3,347 Views)
Thanks for your quick reply, John. Increasing the Bytes to Read to 25000 worked for now. A little bit more work on that tool would really make it even more useful, I'm sure.

Thanks again for your help.

-Sheela
0 Kudos
Message 6 of 12
(3,347 Views)
Never mind! The problem was with the pop server. I had to set it up for pop3 access on the server. The error message on Pop session VI should have said connection refused but instead it said password invalid. Anyway, the problem is solved!

Thanks again.
0 Kudos
Message 7 of 12
(3,347 Views)
I see that the e-mail attachments are appended to the body of the message. Is there a way it can be retrieved separately? It is not easy to re-create the attachments as some characters get added to it. More so if the attachments are encrypted for security.

Thanks
0 Kudos
Message 8 of 12
(3,347 Views)
Hello,

Typically email attachments are added to the text of a mail message just as you are seeing in the mail browser. To extract files from this data you must parse it from the message text. The protocol for how this info is encoded is called MIME.

Documents called RFCs define this protocol. These RFCs can be retrieved from http://www.ietf.org/rfc.html. The RFCs corresponding to MIME are 1521, 1522, 1524, 1563, 1437, 1652, 1651, 1556, 1740, and 1741.

Another option is to look at the �SMTP Email Send File� VI included with LabVIEW 7.0. This VI encodes a file into MIME to transmit via SMTP. You could look at this code to try and reverse engineer it to decode MIME.

Hope this helps! Let me know if I can help with or clarify anything.


Ken S.
National Instruments
0 Kudos
Message 9 of 12
(3,347 Views)

Hi

 

I got error 63 at TCP open connection when run Mail Browser.vi. Please see the screenshot attached. Please help me.

Thanks

 

Error 63 occurred at TCP Open Connection in Open POP session.vi->Get All Messages.vi->Mail Browser.vi

Possible reason(s):

LabVIEW: Serial port receive buffer overflow.
=========================
LabVIEW: The network connection was refused by the server.

0 Kudos
Message 10 of 12
(2,612 Views)