Retrieving emails

I have see lots of conversations abouit sending emails but not about downloading emails from an email server.
anybody any idea’s…?

http://documentation.xojo.com/api/networking/pop3securesocket.html

There is CURL from the MBS plugin and the Chilkat plugin. Both have full IMAP functionality.

The hairy part is parsing the emails. The Chilkat plugin parses only very simple emails. The CURL plugin parses simple emails. If you need more contact me directly or wait for an announcement for a new email parser.

@Beatrix Willius - your are supposed to be our email specialist. … which one would you use for a new project ?

If i should guess, i’d guess a yet to be announced email parser :wink:

@Joost Rongen: do you mean between CURL or Chilkat for accessing IMAP accounts? CURL seems to have a simpler interface. The Chilkat plugin is cross language and isn’t really OO.

As for parsing emails both CURL and Chilkat are equally not very good. It really depends on what you need. If you only have simple text or html mails then both are fine. If you got any type of complex structure in your mail or screwed up data then forget both CURL and Chilkat.

First off Thank you all for your replies but seems i have asked a question that is not simple to answer. I will keep going with the pop3securesocket and let you know if i succeed. Sorry if I wasted your time.

Ian

[quote=420942:@Ian Cartwright]I have see lots of conversations abouit sending emails but not about downloading emails from an email server.
anybody any ideas…?[/quote]
I wrote my own from scratch, including the download, recursive parsing of complex bodies, attachment handling, and a Bayesian spam filter. It depends what you want to do, really.

HI Tim,

I want to send and receive emails from a program that is not as complex as the ones we usually use.

I will keep going and see what I can come up with.

You have succeeded in doing what I want to do.

Ian

Something you could put up on GitHub or alike? :slight_smile:

Hi Sascha,
Not sure if it is something people would be interested in.

But will look into sharing it on GitHub but have never used it before.
Am only in the research phase but will start coding soon as have sorted the plan for the program.

Must tell am a 68 year old dissabled pensioner who cannot afford the plugins meantioned early in this conversation.

Thank for all the help.

Ian

That would be really kind. Thank you :slight_smile:

Then have lots of fun parsing emails.

Some pointers:

Preprocessing: I always make sure that the line endings are of one type. So I use a ReplaceLineEndings on the mail text first.

Mails have a header. The end of the header is where the first 2 line endings are.

Headers have something called “comment folding whitespace” which are line continuations. Haven’t seen comments in the header myself so I only do “folding whitespace” to bake lines together. Lines that start with whitespace belong to the last line.

A header value is “name of header: headervalue” so that this is easy to parse.

Subjects with foreign characters need to be parsed. Example: =?UTF-8?Q?Letzte_Chance:Flatrate_zum_absoluten_Hammerpreis-n?=
=?UTF-8?Q?ur_24_EUR/Jahr
-_f=C3=BCr_J=C3=B6rg!?=

The most important other fields are content type and content disposition. Those have a complex format. 2 examples:

Content-Type: text/plain; charset=utf-8
Content-Type: multipart/alternative; boundary="–==_mimepart_431915af055771c0a3e7d57f39068231"; charset=UTF-8

I think nobody uses the first anymore. This is a simple mail.

The second one of the content types is the most used one. You have a recursive tree structure and you need to hack the rest of the text into pieces with the boundary. With the pieces you again check if you have a header, do the content type again. And so on recursively until you don’t have any multipart pieces. Then you can put everything back together. Multipart-alternative means you take either one parts or the other. Multipart-related means that you need all parts.

No problem.
Please sign up for a trial here.
If you than email me a scan of your certificate of disability, we’d upgrade you to a full license.

1 Like

[quote=421066:@Beatrix Willius]Then have lots of fun parsing emails.

Some pointers:

Preprocessing: I always make sure that the line endings are of one type. So I use a ReplaceLineEndings on the mail text first.

Mails have a header. The end of the header is where the first 2 line endings are.[/quote]

Each “part” of a mail will have its own headers. A “part” may be an image, or the HTML body of a message, for example.

[quote]
Headers have something called “comment folding whitespace” which are line continuations. Haven’t seen comments in the header myself so I only do “folding whitespace” to bake lines together. Lines that start with whitespace belong to the last line.

A header value is “name of header: headervalue” so that this is easy to parse.

Subjects with foreign characters need to be parsed. Example: =?UTF-8?Q?Letzte_Chance:Flatrate_zum_absoluten_Hammerpreis-n?=
=?UTF-8?Q?ur_24_EUR/Jahr
-_f=C3=BCr_J=C3=B6rg!?= [/quote]

These are called “encoded words”. See this Wikipedia article:

which describes, amongst other things, encoded words and why they are needed. The article is a good summary and has lots of pointers for further reading. See also RFC 2822. I must have read all these RFCs dozens of times.

You’ll see that the body is plain text but has been base-64 encoded.

It took me a couple of years to understand all the ins and outs of this and to code everything up.

@Tim Streater : yes, I know all this. I wanted to get Ian started a tiny bit without overwhelming him. Especially the RFCs are awful to read.

I’m still not sure what he wants to do. I thought that by getting an idea of the scope of the matter, he could decide what, for example, to limit himself too. Although it would still be necessary to reject mails that were “out of scope”.

Ha ha yes, you’re not wrong :slight_smile:

This ise VERY VERY kind @Christian Schmitz like

Seeems I have done a bad job of explaining what I want to do so I will try again.

Send emails with attachments if pos.

Retreave emails with attachments if pos.

The program will be open source.

as for the offer from Cristian Schmiz I am not sure what you refer to as a certificate as all have is letter from the Department of works and pension refering to my award for personal independence payments which is for paying for my carer.

Ian.

meant add that i do have goverment issue dissability badge for my car.