Parse .eml files

Martin Tschierschke mt at smartdolphin.de
Wed Apr 11 15:20:08 UTC 2018


On Wednesday, 11 April 2018 at 02:37:39 UTC, bachmeier wrote:
> 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'

Very cool, I was looking for something similar, thank you both 
for sharing!

My goal is to store mails in a mysql table with fulltext index, 
connected to a existing old crm solution via the email address as 
a foreign key.

My question in the moment is, how do I invoke Thunderbird to 
display a certain single mail (or maildir) file?
How do I use Thunderbird as the client, to show, to answer or to 
forward these mails.
An alternative would be to use a browser based mailer? Handling 
all attachments is an other purpose.




More information about the Digitalmars-d-learn mailing list