T
Ted Byers
I am using Activestate perl 5.10.0 on WXP.
I now have a script that uses Net::IMAP::Simple to get incoming
messages, and Email::Simple to parse the headers easily. Once I have
the information I need from the headers, I use MIME::Lite to send a
multipart/related message using our MS Exchange server. Once I
figured it out, the result seems easy and reliable.
The problem is that I have now been asked to include in the automated
replies the bodies of the messages the script is replying to, and
these too are multipart/related. Is there a relatively painless way
to add the body of the old message as yet another part to the message
I am sending? My first thought was to get the body from the object
returned by Email::Simple->new, from which I had already parsed the
headers, and add those lines of data to the new one using MIME::Lite-
was the intended new body with a nameless attachment with only a
single line of text - none of the data from the original message). It
is certain that this approach is wrong, but the question is, what
should I have done?
If I can get MIME:arser to extract the html part and the images in
the incoming messages, so I can write those to files, I can then
create a new part from those files, but I have yet to get MIME:arser
to parse multipart/related or multipart/alternative messages in a way
that I can get at either the html part or the images. I suspect I
haven't really understood, yet, how to use MIME:arser properly with
multipart messages, but that is a different matter.
To be clear, it is trivial for me to append an original message to an
automated reply when the original is plain text (regardless of the
MIME type of the automated reply), but I am presently at a loss as to
how to do so when both the automated reply (without the original) and
the original messages are multipart/related MIME messages (using html
for the body and various different media either embedded or attached.
I clearly need a little guidance on which MIME packages I should
examine, and how to use them to achieve what is required.
Thanks
Ted
I now have a script that uses Net::IMAP::Simple to get incoming
messages, and Email::Simple to parse the headers easily. Once I have
the information I need from the headers, I use MIME::Lite to send a
multipart/related message using our MS Exchange server. Once I
figured it out, the result seems easy and reliable.
The problem is that I have now been asked to include in the automated
replies the bodies of the messages the script is replying to, and
these too are multipart/related. Is there a relatively painless way
to add the body of the old message as yet another part to the message
I am sending? My first thought was to get the body from the object
returned by Email::Simple->new, from which I had already parsed the
headers, and add those lines of data to the new one using MIME::Lite-
sending, but that produced something incomprehensible (i.e. the resultbuild on the old body to make another part to the message I am
was the intended new body with a nameless attachment with only a
single line of text - none of the data from the original message). It
is certain that this approach is wrong, but the question is, what
should I have done?
If I can get MIME:arser to extract the html part and the images in
the incoming messages, so I can write those to files, I can then
create a new part from those files, but I have yet to get MIME:arser
to parse multipart/related or multipart/alternative messages in a way
that I can get at either the html part or the images. I suspect I
haven't really understood, yet, how to use MIME:arser properly with
multipart messages, but that is a different matter.
To be clear, it is trivial for me to append an original message to an
automated reply when the original is plain text (regardless of the
MIME type of the automated reply), but I am presently at a loss as to
how to do so when both the automated reply (without the original) and
the original messages are multipart/related MIME messages (using html
for the body and various different media either embedded or attached.
I clearly need a little guidance on which MIME packages I should
examine, and how to use them to achieve what is required.
Thanks
Ted