Parse .eml files

bachmeier no at spam.net
Wed Apr 11 02:37:39 UTC 2018


On Monday, 9 April 2018 at 19:17:20 UTC, Adam D. Ruppe wrote:

[...]

I had a chance to try this out and it worked without a problem. I 
did have to download color.d in addition to the other 
dependencies you listed. In the event that Google brings someone 
here, this is a complete working program:

import std.file, std.stdio, std.string;
import arsd.email;

void main(string[] args) {
   string[] f = std.file.readText(args[1]).splitLines();
   auto em = new IncomingEmailMessage(f);
   writeln("From: ", em.from);
   writeln("To: ", em.to);
   writeln("Subject: ", em.subject);
   writeln(em.textMessageBody);
}

Compile with

dmd *.d -ofreademail

And run

./reademail 'email message.eml'



More information about the Digitalmars-d-learn mailing list