Parse .eml files

Adam D. Ruppe destructionator at gmail.com
Mon Apr 9 19:17:20 UTC 2018


On Monday, 9 April 2018 at 18:47:16 UTC, bachmeier wrote:
> Is there a way to do this in D? The email libraries I've found 
> don't appear to work with .eml.

My understanding is .eml is the same MIME format the email itself 
and mbox and maildir all use.

So any of those libraries are likely to work with it.

You should open the eml file in Notepad or whatever and see if 
there are more than one message in it. If so, my email.d can 
handle is mbox 
http://dpldocs.info/experimental-docs/arsd.email.processMboxData.html

just `cast(immutable(ubyte)[]) std.file.read` the file to get 
that array.

Otherwise, my email.d would do it as an individual message you 
can construct with this: 
http://dpldocs.info/experimental-docs/arsd.email.IncomingEmailMessage.this.1.html

just std.file.readText and splitLines to get the string[] array.

my email.d is here 
https://github.com/adamdruppe/arsd/blob/master/email.d it depends 
on dom.d htmltotext.d and characterencodings.d

or on dub http://code.dlang.org/packages/arsd-official%3Aemail


More information about the Digitalmars-d-learn mailing list