Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser for eml files? #265

Open
piernik opened this issue Nov 9, 2017 · 19 comments
Open

Parser for eml files? #265

piernik opened this issue Nov 9, 2017 · 19 comments

Comments

@piernik
Copy link

piernik commented Nov 9, 2017

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.

@Slamdunk
Copy link
Collaborator

Slamdunk commented Nov 9, 2017

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

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

@piernik
Copy link
Author

piernik commented Nov 10, 2017

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).

@Slamdunk
Copy link
Collaborator

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.

@piernik
Copy link
Author

piernik commented Nov 10, 2017

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

@Slamdunk
Copy link
Collaborator

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 Slamdunk added this to the 1.2 milestone Nov 12, 2017
@piernik
Copy link
Author

piernik commented Nov 13, 2017

Would be great.

@piernik
Copy link
Author

piernik commented Dec 1, 2017

Whe do You expect deliver it??

@Slamdunk
Copy link
Collaborator

Slamdunk commented Dec 1, 2017

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

@piernik
Copy link
Author

piernik commented Dec 1, 2017

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??

@Slamdunk
Copy link
Collaborator

Slamdunk commented Dec 1, 2017

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.

@piernik
Copy link
Author

piernik commented Dec 1, 2017

I understad - I'll use different parser :/

@Slamdunk Slamdunk modified the milestones: 1.2, 1.3 Jan 15, 2018
@piernik
Copy link
Author

piernik commented Feb 13, 2018

Any news on that?

@Slamdunk
Copy link
Collaborator

Not yet

@Slamdunk Slamdunk modified the milestones: 1.3, 1.4 Feb 28, 2018
@Slamdunk Slamdunk modified the milestones: 1.4, 1.5 Mar 19, 2018
@Slamdunk Slamdunk modified the milestones: 1.5, 1.6, Whishlist Mar 26, 2018
@pyatnitsev
Copy link
Contributor

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

@Slamdunk
Copy link
Collaborator

Slamdunk commented Mar 5, 2019

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.

@pyatnitsev
Copy link
Contributor

pyatnitsev commented Dec 10, 2019

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
Copy link
Contributor

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?

@Slamdunk
Copy link
Collaborator

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.

@rikvdh
Copy link

rikvdh commented Jan 25, 2025

@Slamdunk I was working on this as I was migrating from laminas-mail to here and I need this for testing.

I am quite far with this, some 'final' keywords in the AbstractMessage need to go in order to override them in a 'EmlMessage' class. It can decode headers now, no problem. But when decoding content, it relies on a structure-object generated by imap_fetchstructure.

I see a way with php-mime-mail-parser/php-mime-mail-parser or using mailparse directly. But is that desirable? I don't want to put effort in making it work when that route is not 'the way to go forward'.

See https://github.com/ddeboer/imap/compare/master...rikvdh:imap:feature/eml-import?expand=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants