Search The ForumSearch   RegisterRegister  LoginLogin

MailBee POP3

 AfterLogic Forum : MailBee POP3
Subject Topic: Sample app Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
bobdog
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 08 June 2004 at 1:52pm | IP Logged Quote bobdog

I need to create a very simple app. I want to check one mailbox that will have PDFs and Word docs attached to messages. Is there a way to know what the attachment's filename is so that it can be saved with the correct name/extension?
Back to Top View bobdog's Profile Search for other posts by bobdog
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 08 June 2004 at 2:15pm | IP Logged Quote Alex

Yes, MailBee.Attachment object provides Filename property which returns you filename of the attachment.

Also, you can use Attachment.SaveFile method to save the attachment into any folder under the attachment's real name.

The following example retrieves a message from the server and saves all of the attachments found in the message into a disk folder. All attachments are saved under their real names.


Dim objPOP3, objMsg, objAttach

Set objPOP3 = CreateObject("MailBee.POP3")

objPOP3.LicenseKey = "put your license key here"

' Connect to the server
If objPOP3.Connect("mail.server.com", 110, "jdoe", "secret") Then

' Retrieve first message
Set objMsg = objPOP3.RetrieveSingleMessage(1)

If objPOP3.IsError Then
    ' Check for errors
    MsgBox "Error #" & objPOP3.ErrCode
Else
    ' Iterate through all of the attachments
    For Each objAttach In objMsg.Attachments
      ' Save each attachment to disk
      If Not objAttach.SaveFile("C:\Attachments") Then
        MsgBox "Could not save a file"
      End If
    Next
End If

' Disconnect when finished
objPOP3.Disconnect
End If
Back to Top View Alex's Profile Search for other posts by Alex
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide