Login  
Search All Forums
Dart Home | PowerTCP Mail for ActiveX | Custom Development Reply | PowerTCP Mail for ActiveX Topics | Forums   
AuthorForum: PowerTCP Mail for ActiveX
Topic: Creating a Console application using IMAP
jbutler
jpbutler@co.pinellas.fl.us

From: Clearwater, FL USA
Posts: 6
Member Since: 11/18/03
posted November 18, 2003 3:09 PM

Does anyone know if it is possible to create a console application using PowerTCP Mail Tool? Or does it need a Windows Form to function properly? Thanks in advance.

I would like to create a console application to access folders and move messages.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted November 18, 2003 3:43 PM

Yes, you can create a console application. I have put a very simple sample here:

http://support.dart.com/downloads/PopConsole.zip

I know it's Pop and not Imap, but it's all I have and it should be enough to get you started. There are some constants that you have to edit in the PopConsole.cpp.

jbutler
jpbutler@co.pinellas.fl.us

From: Clearwater, FL USA
Posts: 6
Member Since: 11/18/03
posted November 18, 2003 3:50 PM

Thanks for the response, but I was looking for a console example in .NET. I'm using VB.NET.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted November 18, 2003 4:23 PM

That can be done as well, but I don't have an example. It's actually easier in .NET than in the C++ sample that I referenced before.
jbutler
jpbutler@co.pinellas.fl.us

From: Clearwater, FL USA
Posts: 6
Member Since: 11/18/03
posted November 18, 2003 4:45 PM

Yeah...I think it would be easy, but getting an error when trying to log in...

Public WithEvents Imap1 As DartMail.Imap

  Sub Main()
    If DoLogin() Then
      Console.WriteLine("Login Successful")
      Console.Read()
    Else
      Console.WriteLine("Try Again")
      Console.Read()
    End If
  End Sub


  Public Function DoLogin() As Boolean
    'Imap1.Timeout = 30000

    Console.WriteLine("Attempting Login ...")

    On Error GoTo OnError
    Imap1.Login("mail.com", "user", "password")
    'Console.WriteLine("Successful Login")
    DoLogin = True
    Exit Function

OnError:
    Console.WriteLine(Err.Description)
    Console.Read()
    DoLogin = False
  End Function

End Module
--------------------------

Getting "object reference not set to instance of an object" error.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted November 18, 2003 5:29 PM

I just found out that it's not as simple as I thought. Search here for the word "Reflection" and you should see a couple articles where people are discussing creating COM object without forms in .NET. Hopefully you will find what you need there.

If you want to avoid all that stuff, I would suggest getting our Mail for .NET product, which contains native .NET framework components that are much easier to use as console apps.

Reply | PowerTCP Mail for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX