SSST2009 Posted February 20, 2009 Report Share Posted February 20, 2009 I'm a beginner with Labview but I have a project in which it is demand to save some attachments from a e-mail with the POP3 protocol. I found how to read the e-mail but not how to save the attachment. I'm using Labview 8.5. Any suggestion? Thx! Quote Link to comment
Mark Yedinak Posted February 20, 2009 Report Share Posted February 20, 2009 You will have to decode the body of the message. Most email application use MIME encoding. You will need to decode the MIME encoded data and extract the content of the attachment from that. Here are two examples (the separators "----- Label ----" are not part of the POP3 data.) of a message both with the same content however one was sent as plain text and the other as an attachment. --------Plain Text Message ---------- Received: from 10.3.4.98 ([10.3.4.98]) by 03ctctestexch.ctc-zebra.test with Microsoft SMTPSVC(6.0.3790.1830); Thu, 19 Feb 2009 14:21:16 -0600 To: lab_tester@ctc-zebra.test From: fubar@blegga.com Subject: Test (Send as plain text) Return-Path: fubar@blegga.com Message-ID: <03CTCTESTEXCH8wSA1X00000004@03ctctestexch.ctc-zebra.test> X-OriginalArrivalTime: 19 Feb 2009 20:21:16.0898 (UTC) FILETIME=[9E544C20:01C992CF] Date: 19 Feb 2009 14:21:16 -0600 ^xa ^fo0, 0^a0,,20^fdUnderachievement -- The tallest blade of grass is the first to be cut by the lawnmower.^fs ^HCN ^xz . ------- End of message --------- ------- Attached data ---------- Received: from 10.3.4.98 ([10.3.4.98]) by 03ctctestexch.ctc-zebra.test with Microsoft SMTPSVC(6.0.3790.1830); Thu, 19 Feb 2009 14:21:16 -0600 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="LabVIEW_SMTP_MIME_Boundary" Content-Transfer-Encoding: 7bit To: lab_tester@ctc-zebra.test From: fubar@blegga.com Subject: Test (Send as file attachment) Date: Thu, 19 Feb 2009 14:21:22 -0600 Return-Path: fubar@blegga.com Message-ID: <03CTCTESTEXCHFRaqbC00000003@03ctctestexch.ctc-zebra.test> X-OriginalArrivalTime: 19 Feb 2009 20:21:16.0528 (UTC) FILETIME=[9E1BD700:01C992CF] --LabVIEW_SMTP_MIME_Boundary Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable --LabVIEW_SMTP_MIME_Boundary Content-Type: text/plain; name="supersmall.zpl"; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="supersmall.zpl" ^xa ^fo0, 0^a0,,20^fdUnderachievement -- The tallest blade of grass is the f= irst to be cut by the lawnmower.^fs ^HCN ^xz --LabVIEW_SMTP_MIME_Boundary-- . ------- End of message --------- I have also include the libraries that I use for POP3 messaging. I found these on the internet several years ago. Quote Link to comment
SSST2009 Posted February 22, 2009 Author Report Share Posted February 22, 2009 QUOTE (Mark Yedinak @ Feb 19 2009, 09:38 PM) You will have to decode the body of the message. Most email application use MIME encoding. You will need to decode the MIME encoded data and extract the content of the attachment from that. Here are two examples (the separators "----- Label ----" are not part of the POP3 data.) of a message both with the same content however one was sent as plain text and the other as an attachment.--------Plain Text Message ---------- Received: from 10.3.4.98 ([10.3.4.98]) by 03ctctestexch.ctc-zebra.test with Microsoft SMTPSVC(6.0.3790.1830); Thu, 19 Feb 2009 14:21:16 -0600 To: lab_tester@ctc-zebra.test From: fubar@blegga.com Subject: Test (Send as plain text) Return-Path: fubar@blegga.com Message-ID: <03CTCTESTEXCH8wSA1X00000004@03ctctestexch.ctc-zebra.test> X-OriginalArrivalTime: 19 Feb 2009 20:21:16.0898 (UTC) FILETIME=[9E544C20:01C992CF] Date: 19 Feb 2009 14:21:16 -0600 ^xa ^fo0, 0^a0,,20^fdUnderachievement -- The tallest blade of grass is the first to be cut by the lawnmower.^fs ^HCN ^xz . ------- End of message --------- ------- Attached data ---------- Received: from 10.3.4.98 ([10.3.4.98]) by 03ctctestexch.ctc-zebra.test with Microsoft SMTPSVC(6.0.3790.1830); Thu, 19 Feb 2009 14:21:16 -0600 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="LabVIEW_SMTP_MIME_Boundary" Content-Transfer-Encoding: 7bit To: lab_tester@ctc-zebra.test From: fubar@blegga.com Subject: Test (Send as file attachment) Date: Thu, 19 Feb 2009 14:21:22 -0600 Return-Path: fubar@blegga.com Message-ID: <03CTCTESTEXCHFRaqbC00000003@03ctctestexch.ctc-zebra.test> X-OriginalArrivalTime: 19 Feb 2009 20:21:16.0528 (UTC) FILETIME=[9E1BD700:01C992CF] --LabVIEW_SMTP_MIME_Boundary Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable --LabVIEW_SMTP_MIME_Boundary Content-Type: text/plain; name="supersmall.zpl"; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="supersmall.zpl" ^xa ^fo0, 0^a0,,20^fdUnderachievement -- The tallest blade of grass is the f= irst to be cut by the lawnmower.^fs ^HCN ^xz --LabVIEW_SMTP_MIME_Boundary-- . ------- End of message --------- I have also include the libraries that I use for POP3 messaging. I found these on the internet several years ago. Tank's for the answer! I told that I'm a beginner and I'm really a beginner.... I have no idea about what is a MIME encoding... Maybe I didn't explain in a good way my problem, in fact I will recive an e-mail in a e-mail account (like hotmail or yahoo) and from there I must save in a folder on my PC the attachment of this mail. I found how to read the e-mail but I have no idea how to save the attachement. Can you help me a little bit more? I include the program to see the mail that I found on the Net. http://lavag.org/old_files/post-14780-1235221813.zip'>Download File:post-14780-1235221813.zip Thank's for any suggestion! Quote Link to comment
Rolf Kalbermatter Posted February 23, 2009 Report Share Posted February 23, 2009 QUOTE (SSST2009 @ Feb 21 2009, 09:13 AM) Tank's for the answer!I told that I'm a beginner and I'm really a beginner.... I have no idea about what is a MIME encoding... Then you should read some of the internet RFCs (Request for Comments). They are open documents that describe just about any protocol and aspect of the internet and although sometimes a bit difficult to read the authoritive source about how a protocol should be implemented. QUOTE Maybe I didn't explain in a good way my problem, in fact I will receive an e-mail in a e-mail account (like hotmail or yahoo) and from there I must save in a folder on my PC the attachment of this mail. I found how to read the e-mail but I have no idea how to save the attachement. Can you help me a little bit more? I'm surprised that you say you are using this library to read messages from hotmail or yahoo. They to the best of my knowledge will not allow clear text password logins and that is for a good reason. You should not do anything like clear word passwords over any other network than your internal and firewalled home or office network. As far as I know there is no real LabVIEW POP library out in the wild for free that does allow more than basic (clear text and possibly Base64 password authentification) which are all basically clear text. Most people having to deal with either SMTP or POP login did usually resolve to using ActiveX to use the Outlook email API to do all that. Rolf Kalbermatter Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.