modules to detach attachments and form replies?

D

Don McLaughlin

I've looked at CPAN's Mail and News sections and couldn't find what I
needed so I'd appreciate any pointers to modules or sample code.

(1) I'm sure I've seen a module somewhere for separating MIME parts of
e-mails, but I can't find it now. I want to strip away everything else
and retain just the plain text part.

(2) I want to form a reply mail/news body from an original body, in
other words turn

From: Alice ...
Bob wrote:

What's going on?

I don't know

into
I don't know

so I can add a reply to the end. I'm sure this is a standard thing so
I'm surprised I haven't seen anything to do it. transforms the headers into a reply but leaves the body empty. I'm
looking for something to do the body only or both the body and the
headers.

Thanks,
Don
 
P

Paul Lalli

Don said:
I've looked at CPAN's Mail and News sections and couldn't find what I
needed so I'd appreciate any pointers to modules or sample code.

(1) I'm sure I've seen a module somewhere for separating MIME parts of
e-mails, but I can't find it now. I want to strip away everything else
and retain just the plain text part.

Odd. When I go to http://search.cpan.org, and search for 'Email Mime',
the third result is:
http://search.cpan.org/~cwest/Email-MIME-1.82/MIME.pm
which seems to do exactly what you wanted.
(2) I want to form a reply mail/news body from an original body, in
other words turn

From: Alice ...


I don't know

into


so I can add a reply to the end. I'm sure this is a standard thing so
I'm surprised I haven't seen anything to do it.

Odd. When I go to http://search.cpan.org, and search for 'Reply', the
very first thing listed is:
http://search.cpan.org/~cwest/Email-Reply-1.1/lib/Email/Reply.pm
which seems to do exactly what you asked for.

Now, this is not *entirely* you're fault. As has been recently
discussed in another thread, the browse-by-category feature of CPAN
seems to be lacking, in that not every module which falls into a given
category is listed. But please, in the future, at least *try* to
search on some keywords.

Paul Lalli
 
D

Don McLaughlin

Odd. When I go to http://search.cpan.org, and search for 'Email Mime',
the third result is:
http://search.cpan.org/~cwest/Email-MIME-1.82/MIME.pm
which seems to do exactly what you wanted.

Looks perfect, thanks.
Odd. When I go to http://search.cpan.org, and search for 'Reply', the
very first thing listed is:
http://search.cpan.org/~cwest/Email-Reply-1.1/lib/Email/Reply.pm
which seems to do exactly what you asked for.

Thanks again.
Now, this is not *entirely* you're fault.

Sorry about the part this is my fault! I appreciate your patience.
As has been recently
discussed in another thread, the browse-by-category feature of CPAN
seems to be lacking, in that not every module which falls into a given
category is listed. But please, in the future, at least *try* to
search on some keywords.

Hmm. Several times in the past I've had lousy luck with keyword
searches so recently I've been using the categories. I'd better try
both in the future.

Thanks for your help,
Don
 
D

Don McLaughlin

Paul Lalli said:
Odd. When I go to http://search.cpan.org, and search for 'Email Mime',
the third result is:
http://search.cpan.org/~cwest/Email-MIME-1.82/MIME.pm
which seems to do exactly what you wanted.

So far so good.
Odd. When I go to http://search.cpan.org, and search for 'Reply', the
very first thing listed is:
http://search.cpan.org/~cwest/Email-Reply-1.1/lib/Email/Reply.pm
which seems to do exactly what you asked for.

# perl -MCPAN -e 'install Email::Reply'

..

Checking if your kit is complete...
Looks good
Writing Makefile for Email::Reply
cp lib/Email/Reply.pm blib/lib/Email/Reply.pm
Manifying blib/man3/Email::Reply.3pm
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/test....NOK 7# Failed test (t/test.t at line 63)

..

t/test....ok 8/0# Looks like you failed 1 tests of 8.
t/test....dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 7
Failed 1/8 tests, 87.50% okay
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/test.t 1 256 8 1 12.50% 7
Failed 1/1 test scripts, 0.00% okay. 1/8 subtests failed, 87.50% okay.
make: *** [test_dynamic] Error 2
/usr/bin/make test -- NOT OK
Running make install
make test had returned bad status, won't install without force


I'd appreciate suggestions on how to fix this!

Thanks,
Don
 
P

Paul Lalli

Don said:
# perl -MCPAN -e 'install Email::Reply'

Checking if your kit is complete...
Looks good
Writing Makefile for Email::Reply
cp lib/Email/Reply.pm blib/lib/Email/Reply.pm
Manifying blib/man3/Email::Reply.3pm
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/test....NOK 7# Failed test (t/test.t at line 63)

.

When I run this, it prints out a rather lengthy explanation of why the
test failed. Did you snip that explanation, thinking it wasn't
important?
From what I can tell, the only difference between what the test
"expected" and what the code actually produced are these lines:
Content-Type: multipart/mixed; boundary="boundary42";
charset="us-ascii"
Content-Type: multipart/mixed; charset="us-ascii";
boundary="boundary42"

I admit to not knowing the mail format proticols that well, but I'm
*guessing* this doesn't make a difference. I'd suggest it'd be okay
to go ahead and force the installation, even with this failed test.

perl -MCPAN -e'force install Email::Reply'

Paul Lalli
 
D

Don McLaughlin

When I run this, it prints out a rather lengthy explanation of why the
test failed. Did you snip that explanation, thinking it wasn't
important?

I thought I'd get buzzed for posting that big a dump. Also, I couldn't
find the specific error in it.
"expected" and what the code actually produced are these lines:
Content-Type: multipart/mixed; boundary="boundary42";
charset="us-ascii"
Content-Type: multipart/mixed; charset="us-ascii";
boundary="boundary42"

I think that my problem is similar.
I admit to not knowing the mail format proticols that well, but I'm
*guessing* this doesn't make a difference. I'd suggest it'd be okay
to go ahead and force the installation, even with this failed test.

perl -MCPAN -e'force install Email::Reply'

I couldn't get that to work (I got the same refusal message as before)
but I got it with this:

perl -MCPAN -e shell
cpan> force install Email::Reply

Hope it works!

Thanks for all your help,
Don
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,175
Messages
2,570,944
Members
47,491
Latest member
mohitk

Latest Threads

Top