pop3 Email problem

William Hunter

Active Member
Licensed User
Longtime User
:BangHead: I am new to B4A and having difficulty getting started on a first project I had thought would not be such a challenge. I am trying to understand how pop3 works, and thought a project to access a pop3 account, then download the subject and from address in list form would be a good place to start. I had thought of providing a check box for each item, to select those items to be deleted, and go on from there. Just a simple means of purging junk mail.

I have found Byak@’s post re pop3Client and SMTPClient modules, but haven’t found any projects illustrating their use. Has anyone completed a project similar to what I have in mind that they would share as a learning resource for others to use? Any help would be greatly appreciated.
 

Smee

Well-Known Member
Licensed User
Longtime User
I just set up a gmail account and then use this code to send. I have not done anything with receiving yet

B4X:
SMTP.Initialize(server, port, emailname, Password,"SMTP")
SMTP.UseSSL=True

    SMTP.To.Add("emailto@somewhere.com")
    SMTP.Subject = "Test"
    SMTP.Body = "This is the message body."
    SMTP.AddAttachment(dir, fileName)
    SMTP.Send

hope this helps
 
Upvote 0

William Hunter

Active Member
Licensed User
Longtime User
pop3 and top commands

@ Smee & Erel – Thank you both for your responses. My interest in coding is strictly as a hobbyist. It’s interesting work, challenging and keeps the mind nimble.

I worked with VB-3 a number of years ago, but gave it up due to time constraints. I started coding again, a few years ago, using AutoIt. I have looked in every nook and cranny of the B4A forum, reading everything I have found of interest. As I examine the B4A application I continually find more and more good news. B4A is an outstanding environment for application development.

I was surprised to find no coverage in the forum, with respect to the top commands of pop3. But, in looking into things further, I guess it should be no surprise. I would think that retrieving the mail headers, and the few first lines of the message should not be all that difficult. But because the header info by message is dynamic, rather than static, a means of extracting the message subject and from address eludes me. I was hoping that someone with advanced knowledge of B4A would have achieved this, and would be willing to post a code example to share their knowledge.

It’s going to be a while before I produce anything of much consequence. I have a lot of reading to do before I get up to speed. Time to dust off my old VB-3 manuals. If anyone has a code sample illustrating how to accomplish extracting specific information from the headers, and would care to share this information by posting it for we noobies, that would be greatly appreciated. :sign0163: Thanks again, for taking the time to reply.
 
Upvote 0

wl

Well-Known Member
Licensed User
Longtime User
William,

In the current version of the NET library the TOP command is not supported. Nor is the STAT command etc ...

I guess Erel will be adding this sometime ...

However, it seems just as if Erel did not write any wrapper code for these commands as they are available in the Apache library the NET library is using.

Therefore I created my own POP3 library that contains the code of Erel and added the TOP and STAT command: see http://www.b4x.com/forum/libraries-developers-questions/13309-extending-pop3-library.html

If you are interested, please let me know ...

Wim
 
Upvote 0

wl

Well-Known Member
Licensed User
Longtime User
Also,

I will be needing a way of parsing the headers as well (note that with a TOP 0 only - but full - headers are retrieved from the POP3 server); I intend to write this very soon.
 
Upvote 0

wl

Well-Known Member
Licensed User
Longtime User
Also,

I will be needing a way of parsing the headers as well (note that with a TOP 0 only - but full - headers are retrieved from the POP3 server); I intend to write this very soon.

It seems the Apache common library does not provide a way to parse the mail headers.

Though, it should not be very difficuly to provide some basic parsing myself ... Will try to do this in a few hours ...
 
Upvote 0

William Hunter

Active Member
Licensed User
Longtime User
pop3 top command

Hello Wim - I would be most interested in seeing your pop3 library, and also any other code you have developed to make use of it. In reading your message I can see that are ahead of me in your knowledge of the subject at hand. I would like to build a simple application to purge junk mail from a pop3 account. On the surface one would think this to be a fairly simple chore, but it isn't. I need to know more than I do to get on with this endeavour. I appreciate your interest. :)
William,

In the current version of the NET library the TOP command is not supported. Nor is the STAT command etc ...

I guess Erel will be adding this sometime ...

However, it seems just as if Erel did not write any wrapper code for these commands as they are available in the Apache library the NET library is using.

Therefore I created my own POP3 library that contains the code of Erel and added the TOP and STAT command: see http://www.b4x.com/forum/libraries-developers-questions/13309-extending-pop3-library.html

If you are interested, please let me know ...

Wim
 
Upvote 0

wl

Well-Known Member
Licensed User
Longtime User
Please send me a private message with your email address if you want my POP3 version (which supports UIDL, STAT and TOP). It also does some basic header parsing.

Wim
 
Upvote 0
Top