[Please do not mail me a copy of your followup]
"astro.del.cielo" <
ve...@lasignature.com> spake the secret code
<rtknnn$1mkj$
1...@gioia.aioe.org> thusly:
>I'm looking working code to get email subject to write to log file.
>Write log is simple.
>I need help with email subject
There are already tools in the unix environment for extracting header
fields from email files such as formail. Consult it's man page.
You can look at the RFC standards that describe the format of a mail
message here:
<
https://en.wikipedia.org/wiki/Email#Internet_Message_Format>
Roughly speaking, it consists of a header, a separator, and the body
of the message. The Subject of an email is in the header. The header
is structured as name/value pairs. The value may be continued across
several lines in the header and value continuation lines in the header
begin with spaces (no other lines in the header begin with spaces).
To obtain the message as a text file that you can parse depends on
your environment. If you're on a linux environment, chances are the
mail messgaes have already been turned into files in your filesystem.
This might be a file in "mailbox" format, but this is not defined by
an RFC standard AFAIK. If you need to get the mail message from a
remote server, then you will need to understand protocols like POP or
IMAP. Both the mailbox format and the POP/IMAP protocols are linked
from the above wikipedia page.
You may see things like =3D in the value of the Subject. This is
quoted-printable encoding described in the RFCs used to encode 8-bit
characters for an environment that is assumed to only be 7-bit clean.
--
"The Direct3D Graphics Pipeline" free book <
http://tinyurl.com/d3d-pipeline>
The Terminals Wiki <
http://terminals-wiki.org>
The Computer Graphics Museum <
http://computergraphicsmuseum.org>
Legalize Adulthood! (my blog) <
http://legalizeadulthood.wordpress.com>