Discussion:
mailing-list to bugs
jrun
2018-05-08 21:01:41 UTC
Permalink
i am looking for a library to parse email messages. i'm assigned to write
something to parse incoming emails on our mailing-list and create bugs in
bugzilla out of them and possibly appending to the existing bug. btw, how would
you do this? would you use Reference: ? can neomutt/mutt be used for this
and/or as a lib?
Depends on the language you use, but mostly I would think about
switching to Request Tracker (RT) which handles email very very
well.
What you want for bugzilla is probably
https://www.bugzilla.org/docs/3.0/html/api/email_in.html
and you probably want to work in Perl.
-dsr-
email_in.pl is limited and perl is not my strong suit :)


-
jrun
Derek Martin
2018-05-09 05:16:15 UTC
Permalink
There are lots of libraries for doing this in lots of languages (python,
go, perl, <your favourite language here>).  Using mutt would be harder
than needed for most tasks unless you don't know how to program at all.
i was hoping for C. found libcmime but it's taking me into c++ which i would
rather not do.
If you really must use C, there's GNU mailutils (which has library
components as well as command line utilities and even entire servers,
as I understand it). I can't say much else about it other than that
it exists, and if memory serves the founder of the project was a
poster here some years ago.
--
Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address. Replying to it will result in
undeliverable mail due to spam prevention. Sorry for the inconvenience.
Derek Martin
2018-05-09 01:46:20 UTC
Permalink
i am looking for a library to parse email messages.
[...]
What you want for bugzilla is probably
https://www.bugzilla.org/docs/3.0/html/api/email_in.html
and you probably want to work in Perl.
I dare say no one should want to work in Perl anymore... It's such a
horrible mishmash of a lanugage. But C is probably not the best tool
for this job either. Python has modules for handling e-mail and for
talking to bugzilla, and for my money it's way, way nicer to code in
than Perl.

C++, FWIW, has much nicer string manipulation than C, and if you
really want to write it in C you'll probably be better off writing it
in C++ just for that--and write the rest of your code like C.

FWIW it took me a while to warm up to C++ (it's very featureful and
large lexicographically) but it was well worth learning, and now I
think you should not write code in pure C any longer unless you're
writing a kernel or similar where you really need that level of
control over the code that's generated. I'd really love to see
Mutt-2.0 rewritten in C++ from the ground up... <ducking>

=8^)
--
Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address. Replying to it will result in
undeliverable mail due to spam prevention. Sorry for the inconvenience.
Ian Zimmerman
2018-05-09 17:55:13 UTC
Permalink
Post by Derek Martin
I dare say no one should want to work in Perl anymore... It's such a
horrible mishmash of a lanugage. But C is probably not the best tool
for this job either. Python has modules for handling e-mail and for
talking to bugzilla, and for my money it's way, way nicer to code in
than Perl.
Since my nick on CPAN used to be THEDEVIL, let me be the devil's
advocate here.

I agree for anything on a "modern" scale - anything that takes more than
a main program file plus maybe a handful of helper modules.

But for certain class of jobs within this ancient scale, perl is still
best IMO. I tentatively define this class as jobs whose string
wrangling plus system call parts dominate everything else. Example:

https://gist.github.com/nobrowser/dfeb275f3273d1e3887c2a24e6f596a6
--
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.
Erik Christiansen
2018-05-09 03:13:28 UTC
Permalink
Post by Derek Martin
I dare say no one should want to work in Perl anymore... It's such a
horrible mishmash of a lanugage.
+1
Post by Derek Martin
But C is probably not the best tool for this job either. Python has
modules for handling e-mail and for talking to bugzilla, and for my
money it's way, way nicer to code in than Perl.
A language which handles (ERE) regexes directly is distinctly to be
preferred. Labouring like a Trojan in C has whiskers on it. OK, I have
done some work with lex & bison, coupled with a regex library, and that
allows the job to be done in C, but even that intermediate level
approach is a lot of work, with resolution of parser conflicts making a
long job of what is much quicker with a less grammatically hidebound
parser in Awk or similar.

Given the expressed familiarity with C, I'd propose Awk as the parsing
language. It has POSIX EREs and a C-like syntax. The Addison-Wesley book
"The AWK Programming Language" was written by the language's authors,
and is a goldmine - brief, to the point, and wonderfully indexed. It is
admittedly too old to include more recent developments like coprocesses,
which allow an Awk daemon to talk to other processes over pipes, but you
can just invoke Awk once per email.

Erik

Loading...