1Email::MIME::AttachmentU:s:eSrtrCiopnpterri(b3u)ted PerlEmDaoiclu:m:eMnItMaEt:i:oAnttachment::Stripper(3)
2
3
4
6 Email::MIME::Attachment::Stripper - strip the attachments from an email
7
9 version 1.317
10
12 my $stripper = Email::MIME::Attachment::Stripper->new($mail);
13
14 my $msg = $stripper->message;
15 my @attachments = $stripper->attachments;
16
18 Given a Email::MIME object, detach all attachments from the message and
19 make them available separately.
20
21 The message you're left with might still be multipart, but it should
22 only be multipart/alternative or multipart/related.
23
24 Given this message:
25
26 + multipart/mixed
27 - text/plain
28 - application/pdf; disposition=attachment
29
30 The PDF will be stripped. Whether the returned message is a single
31 text/plain part or a multipart/mixed message with only the text/plain
32 part remaining in it is not yet guaranteed one way or the other.
33
35 new
36 my $stripper = Email::MIME::Attachment::Stripper->new($email, %args);
37
38 The constructor may be passed an Email::MIME object, a reference to a
39 string, or any other value that Email::Abstract (if available) can cast
40 to an Email::MIME object.
41
42 Valid arguments include:
43
44 force_filename - try harder to get a filename, making one up if necessary
45
46 message
47 my $email_mime = $stripper->message;
48
49 This returns the message with all the attachments detached. This will
50 alter both the body and the header of the message.
51
52 attachments
53 my @attachments = $stripper->attachments;
54
55 This returns a list of all the attachments we found in the message, as
56 a hash of { filename, content_type, payload }.
57
58 This may contain parts that might not normally be considered
59 attachments, like text/html or multipart/alternative.
60
62 This module's behavior has never been very clearly spelled out, and it
63 has led to misunderstandings and bug reports, which may or may not be
64 actual bugs. I plan to take some significant action to address this.
65 To read more or comment, please see
66 <https://github.com/rjbs/Email-MIME-Attachment-Stripper/issues/2>
67
69 This module is incredibly closely derived from Tony Bowden's
70 Mail::Message::Attachment::Stripper; this derivation was done by Simon
71 Cozens ("simon@cpan.org"), and you receive this under the same terms as
72 Tony's original module.
73
75 Simon Cozens
76
78 This software is copyright (c) 2004 by Simon Cozens.
79
80 This is free software; you can redistribute it and/or modify it under
81 the same terms as the Perl 5 programming language system itself.
82
83
84
85perl v5.30.1 2020-01-2E9mail::MIME::Attachment::Stripper(3)