imap icon indicating copy to clipboard operation
imap copied to clipboard

Parser for eml files?

Open piernik opened this issue 7 years ago • 18 comments

Is it possible to use Your library as parser of eml files? Now I'm using https://github.com/php-mime-mail-parser/php-mime-mail-parser

But it would be great to use only one library.

piernik avatar Nov 09 '17 14:11 piernik

Theoretically yes, an EML file can be treated like an EmbeddedMessage.

Would you be so kind to create PR containing a proof-of-concept?

Slamdunk avatar Nov 09 '17 14:11 Slamdunk

I think It's not possible right now. EmbeddedMessage extends AbstractPart at the end which needs Imap resource as constructor param. All interesting methods are in AbstractPart class (as I think).

piernik avatar Nov 10 '17 09:11 piernik

You are right, I was referring that there is only one raw imap call in the whole EmbeddedMessage logic to serve the BasicMessageInterface API, and that call is easily overwritable to work with an EML file.

Slamdunk avatar Nov 10 '17 09:11 Slamdunk

So it's not possible to use those methods without IMAP resource? Are You planning to adjust Your lib to use eml parser?

piernik avatar Nov 10 '17 11:11 piernik

It is possible, and I think pretty straightforward, to get what you ask.

Not soon though. I'll tag it in 1.2 milestone.

Slamdunk avatar Nov 12 '17 10:11 Slamdunk

Would be great.

piernik avatar Nov 13 '17 07:11 piernik

Whe do You expect deliver it??

piernik avatar Dec 01 '17 10:12 piernik

I don't know yet, I have personal issues that keep me off coding.

Slamdunk avatar Dec 01 '17 11:12 Slamdunk

maybe a timeframe? I need to publish my project by the end of the year so by 15th I need to start testing. Will it be ready within 2 weeks??

piernik avatar Dec 01 '17 11:12 piernik

This is a free and open source software developed for free and maintained in our spare time, we can't guarantee any timeframe, so we don't give them.

Slamdunk avatar Dec 01 '17 11:12 Slamdunk

I understad - I'll use different parser :/

piernik avatar Dec 01 '17 11:12 piernik

Any news on that?

piernik avatar Feb 13 '18 13:02 piernik

Not yet

Slamdunk avatar Feb 13 '18 13:02 Slamdunk

Is it actual? Do you need some help with PR?

pyatnitsev avatar Mar 05 '19 15:03 pyatnitsev

I'd like to be honest: I'm not working on this and I haven't even planned to.

Any PR is welcome: I think it should be easy to get a parser that returns a BasicMessageInterface implementation for a generic message.

Tests are mandatory: start the basic feature against tests/fixtures/plain_only.eml and submit a PR, after discussing the general approach a more comprehensive data set can be tested too.

Slamdunk avatar Mar 05 '19 15:03 Slamdunk

Ok. Lets discuss an implementation of this feature. I see it, as a separate class, maybe EmlParser with method parseEml() that have one param - path to eml object and returns instance of new class - ParsedMessage (implements BasicMessageInterface)

Right?

pyatnitsev avatar Dec 10 '19 13:12 pyatnitsev

Another idea: are you realy want to get own implementation of eml parser, maybe better will be integration of https://github.com/php-mime-mail-parser/php-mime-mail-parser to get BasicMessageInterface object?

WDYT?

pyatnitsev avatar Dec 10 '19 14:12 pyatnitsev

https://github.com/php-mime-mail-parser/php-mime-mail-parser is a front-end for the Mailparse extension.

I think it would be good to use that extension too.

A less pretty but still valid idea is to provide an EML parser that just parses the headers with imap_rfc822_parse_headers function, leaving the raw body. This wouldn't require any other third-party library/extension.

Slamdunk avatar Dec 11 '19 07:12 Slamdunk