West Wind Client Tools
Handling photo Attachments in POP3
Gravatar is a globally recognized avatar based on your email address. Handling photo Attachments in POP3
  Cyrus Nima
  All
  Jul 6, 2017 @ 01:49pm

Hi Rick;

I need to capture attachment file and save it with a given file name. When I use your sample code for POP3, the nQty_Att = 1 but the cFileName returned as empty.

And when I try to open the attach.jpg image (please see below), it says the file is unsupported or damaged. When I try to open it with notepad, the email message is also included in the attachment file. Which is strange.

So I am little confused how to capture the attachment photo and be able to save it as a file that can then be opened and viewed.


nQty_got = loPop.Getmessages() 
For x = 1 to nQty_Got
   ? loPop.aMessages[x].cSubject
   ? "From: " + loPop.aMessages[x].cFromName + "  Size: " + TRANSFORM(loPop.aMessages[x].nSize/1000,"999,999,999.99") + "kb"
   ? loPop.aMessages[x].cBody
   nQty_Att = loPop.aMessages[x].nAttachments 
   IF nQty_Att > 0
      ? "Qty of Attachments: " + TRANSFORM( nQty_Att,"9,999") + ' ' + REPLICATE('+', 50)
      * but the following lines don't work.
      FOR y = 1 TO nQty_Att && loPop.aMessages[x].nAttachments
         WAIT 'Processing Attachment # ' + TRANSFORM(y, "9,999") + CR + ;
              'File: ' + loPop.aMessages[x].aAttachments[y].cFileName + " " WINDOW
              
         lcAttachment = loPop.aMessages[x].aAttachments[y].cBody
         = STRTOFILE(lcAttachment, 'c:\trash\attach.jpg')
         
         * Now I have to copy these Attachment Strings into files, with vItem.Ser_No + _1, _2, _3..
      ENDFOR
      ? "---"
   ENDIF
   WAIT 'Next...' WINDOW
EndFor

Gravatar is a globally recognized avatar based on your email address. re: Handling photo Attachments in POP3
  Cyrus Nima
  Cyrus Nima
  Jul 8, 2017 @ 01:19pm

Hi Rick;

Do you think the upgrade to the latest version of WW Client Tools would help the situation with Photo Attachments on POP3?

Thanks. Cyrus

Gravatar is a globally recognized avatar based on your email address. re: Handling photo Attachments in POP3
  Rick Strahl
  Cyrus Nima
  Jul 9, 2017 @ 10:46am

No I don't think so. wwPop3 hasn't been changed in a real long time and it was never meant to be a full fledged mail client - it was always just meant for handling simple message scenarios for Web Servers that needed to validate email messages as part of a Web server.

It's been on my list to update it but these days POP3 has kind of gone by the wayside in favor of IMAP and server hosted messages so I have been holding off.

Frankly, if you're looking for solid POP3 support I'd look at another component like Chilkat or perhaps do interop with OpenPop via .NET with wwDotnetBridge.

+++ Rick ---

© 1996-2017