diff options
| author | fukachan <fukachan> | 2018-01-01 03:52:14 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2018-01-01 03:52:14 +0000 |
| commit | e602fbf764d79003687dd56aa12e6343e086fcd8 (patch) | |
| tree | c4c5dfccf2c393a51bcbe496028662fe4857788a | |
| parent | 3c4d0bcf412dde7975d734ddf893b554d560bb40 (diff) | |
| download | fml8-e602fbf764d79003687dd56aa12e6343e086fcd8.tar.gz fml8-e602fbf764d79003687dd56aa12e6343e086fcd8.tar.bz2 fml8-e602fbf764d79003687dd56aa12e6343e086fcd8.zip | |
Initial revision
| -rw-r--r-- | cpan/lib/Mail/Address.pod | 164 | ||||
| -rw-r--r-- | cpan/lib/Mail/Cap.pod | 157 | ||||
| -rw-r--r-- | cpan/lib/Mail/Field.pod | 196 | ||||
| -rw-r--r-- | cpan/lib/Mail/Field/AddrList.pod | 175 | ||||
| -rw-r--r-- | cpan/lib/Mail/Field/Date.pod | 152 | ||||
| -rw-r--r-- | cpan/lib/Mail/Field/Generic.pm | 33 | ||||
| -rw-r--r-- | cpan/lib/Mail/Field/Generic.pod | 147 | ||||
| -rw-r--r-- | cpan/lib/Mail/Filter.pod | 106 | ||||
| -rw-r--r-- | cpan/lib/Mail/Header.pod | 255 | ||||
| -rw-r--r-- | cpan/lib/Mail/Internet.pod | 387 | ||||
| -rw-r--r-- | cpan/lib/Mail/Mailer.pod | 152 | ||||
| -rw-r--r-- | cpan/lib/Mail/Mailer/smtps.pm | 108 | ||||
| -rw-r--r-- | cpan/lib/Mail/Mailer/testfile.pm | 54 | ||||
| -rw-r--r-- | cpan/lib/Mail/Send.pod | 116 | ||||
| -rw-r--r-- | cpan/lib/Mail/Util.pod | 119 | ||||
| -rw-r--r-- | cpan/lib/MailTools.pm | 11 | ||||
| -rw-r--r-- | cpan/lib/MailTools.pod | 92 |
17 files changed, 2424 insertions, 0 deletions
diff --git a/cpan/lib/Mail/Address.pod b/cpan/lib/Mail/Address.pod new file mode 100644 index 00000000..e3eeb066 --- /dev/null +++ b/cpan/lib/Mail/Address.pod @@ -0,0 +1,164 @@ +=encoding utf8 + +=head1 NAME + +Mail::Address - parse mail addresses + +=head1 SYNOPSIS + + use Mail::Address; + my @addrs = Mail::Address->parse($line); + + foreach $addr (@addrs) { + print $addr->format,"\n"; + } + +=head1 DESCRIPTION + +C<Mail::Address> extracts and manipulates email addresses from a message +header. It cannot be used to extract addresses from some random text. +You can use this module to create RFC822 compliant fields. + +Although C<Mail::Address> is a very popular subject for books, and is +used in many applications, it does a very poor job on the more complex +message fields. It does only handle simple address formats (which +covers about 95% of what can be found). Problems are with + +=over 4 + +=item * + +no support for address groups, even not with the semi-colon as +separator between addresses; + +=item * + +limited support for escapes in phrases and comments. There are +cases where it can get wrong; and + +=item * + +you have to take care of most escaping when you create an address yourself: +C<Mail::Address> does not do that for you. + +=back + +Often requests are made to the maintainers of this code improve this +situation, but this is not a good idea, where it will break zillions +of existing applications. If you wish for a fully RFC2822 compliant +implementation you may take a look at L<Mail::Message::Field::Full>, +part of MailBox. + +B<. Example> + + my $s = Mail::Message::Field::Full->new($from_header); + # ref $s isa Mail::Message::Field::Addresses; + + my @g = $s->groups; # all groups, at least one + # ref $g[0] isa Mail::Message::Field::AddrGroup; + my $ga = $g[0]->addresses; # group addresses + + my @a = $s->addresses; # all addresses + # ref $a[0] isa Mail::Message::Field::Address; + +=head1 METHODS + +=head2 Constructors + +=over 4 + +=item Mail::Address-E<gt>B<new>( PHRASE, ADDRESS, [ COMMENT ] ) + +Create a new C<Mail::Address> object which represents an address with the +elements given. In a message these 3 elements would be seen like: + + PHRASE <ADDRESS> (COMMENT) + ADDRESS (COMMENT) + +example: + + Mail::Address->new("Perl5 Porters", "perl5-porters@africa.nicoh.com"); + +=item $obj-E<gt>B<parse>(LINE) + +Parse the given line a return a list of extracted C<Mail::Address> objects. +The line would normally be one taken from a To,Cc or Bcc line in a message + +example: + + my @addr = Mail::Address->parse($line); + +=back + +=head2 Accessors + +=over 4 + +=item $obj-E<gt>B<address>() + +Return the address part of the object. + +=item $obj-E<gt>B<comment>() + +Return the comment part of the object + +=item $obj-E<gt>B<format>( [ADDRESSes] ) + +Return a string representing the address in a suitable form to be placed +on a C<To>, C<Cc>, or C<Bcc> line of a message. This method is called on +the first ADDRESS to be used; other specified ADDRESSes will be appended, +separated with commas. + +=item $obj-E<gt>B<phrase>() + +Return the phrase part of the object. + +=back + +=head2 Smart accessors + +=over 4 + +=item $obj-E<gt>B<host>() + +Return the address excluding the user id and '@' + +=item $obj-E<gt>B<name>() + +Using the information contained within the object attempt to identify what +the person or groups name is. + +B<Note:> This function tries to be smart with the "phrase" of the +email address, which is probably a very bad idea. Consider to use +L<phrase()|Mail::Address/"Accessors"> itself. + +=item $obj-E<gt>B<user>() + +Return the address excluding the '@' and the mail domain + +=back + +=head1 SEE ALSO + +This module is part of the MailTools distribution, +F<http://perl.overmeer.net/mailtools/>. + +=head1 AUTHORS + +The MailTools bundle was developed by Graham Barr. Later, Mark +Overmeer took over maintenance without commitment to further development. + +Mail::Cap by Gisle Aas E<lt>aas@oslonett.noE<gt>. +Mail::Field::AddrList by Peter Orbaek E<lt>poe@cit.dkE<gt>. +Mail::Mailer and Mail::Send by Tim Bunce E<lt>Tim.Bunce@ig.co.ukE<gt>. +For other contributors see ChangeLog. + +=head1 LICENSE + +Copyrights 1995-2000 Graham Barr E<lt>gbarr@pobox.comE<gt> and +2001-2017 Mark Overmeer E<lt>perl@overmeer.netE<gt>. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. +See F<http://www.perl.com/perl/misc/Artistic.html> + diff --git a/cpan/lib/Mail/Cap.pod b/cpan/lib/Mail/Cap.pod new file mode 100644 index 00000000..96db477b --- /dev/null +++ b/cpan/lib/Mail/Cap.pod @@ -0,0 +1,157 @@ +=encoding utf8 + +=head1 NAME + +Mail::Cap - understand mailcap files + +=head1 SYNOPSIS + + my $mc = Mail::Cap->new; + + my $desc = $mc->description('image/gif'); + print "GIF desc: $desc\n"; + + my $cmd = $mc->viewCmd('text/plain; charset=iso-8859-1', 'file.txt'); + +=head1 DESCRIPTION + +Parse mailcap files as specified in "RFC 1524 --A User Agent +Configuration Mechanism For Multimedia Mail Format Information>. In +the description below C<$type> refers to the MIME type as specified in +the C<Content-Type> header of mail or HTTP messages. Examples of +types are: + + image/gif + text/html + text/plain; charset=iso-8859-1 + +You could also take a look at the File::MimeInfo distribution, which +are accessing tables which are used by many applications on a system, +and therefore have succeeded the mail-cap specifications on modern +(UNIX) systems. + +=head1 METHODS + +=head2 Constructors + +=over 4 + +=item Mail::Cap-E<gt>B<new>(OPTIONS) + +Create and initialize a new Mail::Cap object. If you give it an +argument it will try to parse the specified file. Without any +arguments it will search for the mailcap file using the standard +mailcap path, or the MAILCAPS environment variable if it is defined. + + -Option --Default + filename undef + take 'FIRST' + +=over 2 + +=item filename => FILENAME + +Add the specified file to the list to standard locations. This file +is tried first. + +=item take => 'ALL'|'FIRST' + +Include all mailcap files you can find. By default, only the first +file is parsed, however the RFC tells us to include ALL. To maintain +backwards compatibility, the default only takes the FIRST. + +=back + +example: + + $mcap = new Mail::Cap; + $mcap = new Mail::Cap "/mydir/mailcap"; + $mcap = new Mail::Cap filename => "/mydir/mailcap"; + $mcap = new Mail::Cap take => 'ALL'; + $mcap = Mail::Cap->new(take => 'ALL'); + +=back + +=head2 Run commands + +These methods invoke a suitable program presenting or manipulating the +media object in the specified file. They all return C<1> if a command +was found, and C<0> otherwise. You might test C<$?> for the outcome +of the command. + +=over 4 + +=item $obj-E<gt>B<compose>(TYPE, FILE) + +=item $obj-E<gt>B<edit>(TYPE, FILE) + +=item $obj-E<gt>B<print>(TYPE, FILE) + +=item $obj-E<gt>B<view>(TYPE, FILE) + +=back + +=head2 Command creator + +These methods return a string that is suitable for feeding to system() +in order to invoke a suitable program presenting or manipulating the +media object in the specified file. It will return C<undef> if no +suitable specification exists. + +=over 4 + +=item $obj-E<gt>B<composeCmd>(TYPE, FILE) + +=item $obj-E<gt>B<editCmd>(TYPE, FILE) + +=item $obj-E<gt>B<printCmd>(TYPE, FILE) + +=item $obj-E<gt>B<viewCmd>(TYPE, FILE) + +=back + +=head2 Look-up definitions + +Methods return the corresponding mailcap field for the type. + +=over 4 + +=item $obj-E<gt>B<description>(TYPE) + +=item $obj-E<gt>B<field>(TYPE, FIELD) + +Returns the specified field for the type. Returns undef if no +specification exists. + +=item $obj-E<gt>B<nametemplate>(TYPE) + +=item $obj-E<gt>B<textualnewlines>(TYPE) + +=item $obj-E<gt>B<x11_bitmap>(TYPE) + +=back + +=head1 SEE ALSO + +This module is part of the MailTools distribution, +F<http://perl.overmeer.net/mailtools/>. + +=head1 AUTHORS + +The MailTools bundle was developed by Graham Barr. Later, Mark +Overmeer took over maintenance without commitment to further development. + +Mail::Cap by Gisle Aas E<lt>aas@oslonett.noE<gt>. +Mail::Field::AddrList by Peter Orbaek E<lt>poe@cit.dkE<gt>. +Mail::Mailer and Mail::Send by Tim Bunce E<lt>Tim.Bunce@ig.co.ukE<gt>. +For other contributors see ChangeLog. + +=head1 LICENSE + +Copyrights 1995-2000 Graham Barr E<lt>gbarr@pobox.comE<gt> and +2001-2017 Mark Overmeer E<lt>perl@overmeer.netE<gt>. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. +See F<http://www.perl.com/perl/misc/Artistic.html> + diff --git a/cpan/lib/Mail/Field.pod b/cpan/lib/Mail/Field.pod new file mode 100644 index 00000000..f8374a1b --- /dev/null +++ b/cpan/lib/Mail/Field.pod @@ -0,0 +1,196 @@ +=encoding utf8 + +=head1 NAME + +Mail::Field - base-class for manipulation of mail header fields + +=head1 INHERITANCE + + Mail::Field is extended by + Mail::Field::AddrList + Mail::Field::Date + Mail::Field::Generic + +=head1 SYNOPSIS + + use Mail::Field; + + my $field = Mail::Field->new('Subject', 'some subject text'); + my $field = Mail::Field->new(Subject => 'some subject text'); + print $field->tag,": ",$field->stringify,"\n"; + + my $field = Mail::Field->subject('some subject text'); + +=head1 DESCRIPTION + +C<Mail::Field> creates and manipulates fields in MIME headers, collected +within a L<Mail::Header|Mail::Header> object. Different field types have their +own sub-class (extension), defining additional useful accessors to the +field content. + +People are invited to merge their implementation to special fields into +MailTools, to maintain a consistent set of packages and documentation. + +=head1 METHODS + +=head2 Constructors + +Mail::Field (and it's sub-classes) define several methods which return +new objects. These can all be categorized as constructor. + +=over 4 + +=item Mail::Field-E<gt>B<combine>(FIELDS) + +Take a LIST of C<Mail::Field> objects (which should all be of the same +sub-class) and create a new object in that same class. + +=item Mail::Field-E<gt>B<extract>( TAG, HEAD [, INDEX ] ) + +Takes as arguments the tag name, a C<Mail::Head> object +and optionally an index. + +If the index argument is given then C<extract> will retrieve the given tag +from the C<Mail::Head> object and create a new C<Mail::Field> based object. +I<undef> will be returned in the field does not exist. + +If the index argument is not given the result depends on the context +in which C<extract> is called. If called in a scalar context the result +will be as if C<extract> was called with an index value of zero. If called +in an array context then all tags will be retrieved and a list of +C<Mail::Field> objects will be returned. + +=item Mail::Field-E<gt>B<new>( TAG [, STRING | OPTIONS] ) + +Create an object in the class which defines the field specified by +the TAG argument. + +=back + +=head2 "Fake" constructors + +=over 4 + +=item $obj-E<gt>B<create>(OPTIONS) + +This constructor is used internally with preprocessed field information. +When called on an existing object, its original content will get +replaced. + +=item $obj-E<gt>B<parse>() + +Parse a field line. + +=back + +=head2 Accessors + +=over 4 + +=item $obj-E<gt>B<set>(OPTIONS) + +Change the settings (the content, but then smart) of this field. + +=item $obj-E<gt>B<stringify>() + +Returns the field as a string. + +=item $obj-E<gt>B<tag>() + +=item Mail::Field-E<gt>B<tag>() + +Return the tag (in the correct case) for this item. Well, actually any +casing is OK, because the field tags are treated case-insensitive; however +people have some preferences. + +=back + +=head2 Smart accessors + +=over 4 + +=item $obj-E<gt>B<text>( [STRING] ) + +Without arguments, the field is returned as L<stringify()|Mail::Field/"Accessors"> does. Otherwise, +the STRING is parsed with L<parse()|Mail::Field/""Fake" constructors"> to replace the object's content. + +It is more clear to call either L<stringify()|Mail::Field/"Accessors"> or L<parse()|Mail::Field/""Fake" constructors"> directly, because +this method does not add additional processing. + +=back + +=head1 DETAILS + +=head2 SUB-CLASS PACKAGE NAMES + +All sub-classes should be called Mail::Field::I<name> where I<name> is +derived from the tag using these rules. + +=over 4 + +=item * + +Consider a tag as being made up of elements separated by '-' + +=item * + +Convert all characters to lowercase except the first in each element, which +should be uppercase. + +=item * + +I<name> is then created from these elements by using the first +N characters from each element. + +=item * + +N is calculated by using the formula :- + + int((7 + #elements) / #elements) + +=item * + +I<name> is then limited to a maximum of 8 characters, keeping the first 8 +characters. + +=back + +For an example of this take a look at the definition of the +C<_header_pkg_name()> subroutine in C<Mail::Field> + +=head1 DIAGNOSTICS + +=over 4 + +=item Error: Undefined subroutine <method> called + +Mail::Field objects use autoloading to compile new functionality. +Apparently, the method called is not implemented for the specific +class of the field object. + +=back + +=head1 SEE ALSO + +This module is part of the MailTools distribution, +F<http://perl.overmeer.net/mailtools/>. + +=head1 AUTHORS + +The MailTools bundle was developed by Graham Barr. Later, Mark +Overmeer took over maintenance without commitment to further development. + +Mail::Cap by Gisle Aas E<lt>aas@oslonett.noE<gt>. +Mail::Field::AddrList by Peter Orbaek E<lt>poe@cit.dkE<gt>. +Mail::Mailer and Mail::Send by Tim Bunce E<lt>Tim.Bunce@ig.co.ukE<gt>. +For other contributors see ChangeLog. + +=head1 LICENSE + +Copyrights 1995-2000 Graham Barr E<lt>gbarr@pobox.comE<gt> and +2001-2017 Mark Overmeer E<lt>perl@overmeer.netE<gt>. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. +See F<http://www.perl.com/perl/misc/Artistic.html> + diff --git a/cpan/lib/Mail/Field/AddrList.pod b/cpan/lib/Mail/Field/AddrList.pod new file mode 100644 index 00000000..a42091fd --- /dev/null +++ b/cpan/lib/Mail/Field/AddrList.pod @@ -0,0 +1,175 @@ +=encoding utf8 + +=head1 NAME + +Mail::Field::AddrList - object representation of e-mail address lists + +=head1 INHERITANCE + + Mail::Field::AddrList + is a Mail::Field + +=head1 SYNOPSIS + + use Mail::Field::AddrList; + + $to = Mail::Field->new('To'); + $from = Mail::Field->new('From', 'poe@daimi.aau.dk (Peter Orbaek)'); + + $from->create('foo@bar.com' => 'Mr. Foo', poe => 'Peter'); + $from->parse('foo@bar.com (Mr Foo), Peter Orbaek <poe>'); + + # make a RFC822 header string + print $from->stringify(),"\n"; + + # extract e-mail addresses and names + @addresses = $from->addresses(); # strings + @names = $from->names(); # strings + @addr = $from->addr_list(); # Mail::Address objects (v2.00) + + # adjoin a new address to the list + $from->set_address('foo@bar.com', 'Mr. Foo'); + +=head1 DESCRIPTION + +Defines parsing and formatting of address field, for the following +fields: C<To>, C<From>, C<Cc>, C<Reply-To>, and C<Sender>. + +All the normally used features of the address field specification of +RFC2822 are implemented, but some complex (and therefore hardly ever used) +constructs will not be understood. Use Mail::Message::Field::Full +in MailBox if you need full RFC compliance. + +Extends L<"DESCRIPTION" in Mail::Field|Mail::Field/"DESCRIPTION">. + +=head1 METHODS + +Extends L<"METHODS" in Mail::Field|Mail::Field/"METHODS">. + +=head2 Constructors + +Extends L<"Constructors" in Mail::Field|Mail::Field/"Constructors">. + +=over 4 + +=item Mail::Field::AddrList-E<gt>B<combine>(FIELDS) + +Inherited, see L<Mail::Field/"Constructors"> + +=item Mail::Field::AddrList-E<gt>B<extract>( TAG, HEAD [, INDEX ] ) + +Inherited, see L<Mail::Field/"Constructors"> + +=item Mail::Field::AddrList-E<gt>B<new>( TAG [, STRING | OPTIONS] ) + +Inherited, see L<Mail::Field/"Constructors"> + +=back + +=head2 "Fake" constructors + +Extends L<""Fake" constructors" in Mail::Field|Mail::Field/""Fake" constructors">. + +=over 4 + +=item $obj-E<gt>B<create>(OPTIONS) + +Inherited, see L<Mail::Field/""Fake" constructors"> + +=item $obj-E<gt>B<parse>() + +Inherited, see L<Mail::Field/""Fake" constructors"> + +=back + +=head2 Accessors + +Extends L<"Accessors" in Mail::Field|Mail::Field/"Accessors">. + +=over 4 + +=item $obj-E<gt>B<set>(OPTIONS) + +Inherited, see L<Mail::Field/"Accessors"> + +=item $obj-E<gt>B<stringify>() + +Inherited, see L<Mail::Field/"Accessors"> + +=item $obj-E<gt>B<tag>() + +=item Mail::Field::AddrList-E<gt>B<tag>() + +Inherited, see L<Mail::Field/"Accessors"> + +=back + +=head2 Smart accessors + +Extends L<"Smart accessors" in Mail::Field|Mail::Field/"Smart accessors">. + +=over 4 + +=item $obj-E<gt>B<addr_list>() + +Returns the collected L<Mail::Address|Mail::Address> objects. + +=item $obj-E<gt>B<addresses>() + +Returns a list if email addresses, found in the field content. + +=item $obj-E<gt>B<names>() + +Returns a list of nicely formatted named, for each of the addresses +found in the content. + +=item $obj-E<gt>B<set_address>(EMAIL, NAME) + +Add/replace an EMAIL address to the field. + +=item $obj-E<gt>B<text>( [STRING] ) + +Inherited, see L<Mail::Field/"Smart accessors"> + +=back + +=head1 DETAILS + +Extends L<"DETAILS" in Mail::Field|Mail::Field/"DETAILS">. + +=head1 DIAGNOSTICS + +=over 4 + +=item Error: Undefined subroutine <method> called + +Mail::Field objects use autoloading to compile new functionality. +Apparently, the method called is not implemented for the specific +class of the field object. + +=back + +=head1 SEE ALSO + +This module is part of the MailTools distribution, +F<http://perl.overmeer.net/mailtools/>. + +=head1 AUTHORS + +The MailTools bundle was developed by Graham Barr. Later, Mark +Overmeer took over maintenance without commitment to further development. + +Mail::Cap by Gisle Aas E<lt>aas@oslonett.noE<gt>. +Mail::Field::AddrList by Peter Orbaek E<lt>poe@cit.dkE<gt>. +Mail::Mailer and Mail::Send by Tim Bunce E<lt>Tim.Bunce@ig.co.ukE<gt>. +For other contributors see ChangeLog. + +=head1 LICENSE + +Copyrights 1995-2000 Graham Barr E<lt>gbarr@pobox.comE<gt> and +2001-2017 Mark Overmeer E<lt>perl@overmeer.netE<gt>. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. +See F<http://www.perl.com/perl/misc/Artistic.html> + diff --git a/cpan/lib/Mail/Field/Date.pod b/cpan/lib/Mail/Field/Date.pod new file mode 100644 index 00000000..2a41e19f --- /dev/null +++ b/cpan/lib/Mail/Field/Date.pod @@ -0,0 +1,152 @@ +=encoding utf8 + +=head1 NAME + +Mail::Field::Date - a date header field + +=head1 INHERITANCE + + Mail::Field::Date + is a Mail::Field + +=head1 SYNOPSIS + + use HTTP::Date 'time2iso'; + my $field = Mail::Field->new(Date => time2iso()); + +=head1 DESCRIPTION + +Represents one "Date" header field. + +Extends L<"DESCRIPTION" in Mail::Field|Mail::Field/"DESCRIPTION">. + +=head1 METHODS + +Extends L<"METHODS" in Mail::Field|Mail::Field/"METHODS">. + +=head2 Constructors + +Extends L<"Constructors" in Mail::Field|Mail::Field/"Constructors">. + +=over 4 + +=item Mail::Field::Date-E<gt>B<combine>(FIELDS) + +Inherited, see L<Mail::Field/"Constructors"> + +=item Mail::Field::Date-E<gt>B<extract>( TAG, HEAD [, INDEX ] ) + +Inherited, see L<Mail::Field/"Constructors"> + +=item Mail::Field::Date-E<gt>B<new>( TAG [, STRING | OPTIONS] ) + +Inherited, see L<Mail::Field/"Constructors"> + +=back + +=head2 "Fake" constructors + +Extends L<""Fake" constructors" in Mail::Field|Mail::Field/""Fake" constructors">. + +=over 4 + +=item $obj-E<gt>B<create>(OPTIONS) + +Inherited, see L<Mail::Field/""Fake" constructors"> + +=item $obj-E<gt>B<parse>() + +Inherited, see L<Mail::Field/""Fake" constructors"> + +=back + +=head2 Accessors + +Extends L<"Accessors" in Mail::Field|Mail::Field/"Accessors">. + +=over 4 + +=item $obj-E<gt>B<set>(OPTIONS) + + -Option --Default + Time undef + TimeStr undef + +=over 2 + +=item Time => SECONDS + +=item TimeStr => STRING + +A string acceptable to Date::Parse. + +=back + +=item $obj-E<gt>B<stringify>() + +Inherited, see L<Mail::Field/"Accessors"> + +=item $obj-E<gt>B<tag>() + +=item Mail::Field::Date-E<gt>B<tag>() + +Inherited, see L<Mail::Field/"Accessors"> + +=back + +=head2 Smart accessors + +Extends L<"Smart accessors" in Mail::Field|Mail::Field/"Smart accessors">. + +=over 4 + +=item $obj-E<gt>B<text>( [STRING] ) + +Inherited, see L<Mail::Field/"Smart accessors"> + +=item $obj-E<gt>B<time>( [TIME] ) + +Query (or change) the TIME (as stored in the field) in seconds. + +=back + +=head1 DETAILS + +Extends L<"DETAILS" in Mail::Field|Mail::Field/"DETAILS">. + +=head1 DIAGNOSTICS + +=over 4 + +=item Error: Undefined subroutine <method> called + +Mail::Field objects use autoloading to compile new functionality. +Apparently, the method called is not implemented for the specific +class of the field object. + +=back + +=head1 SEE ALSO + +This module is part of the MailTools distribution, +F<http://perl.overmeer.net/mailtools/>. + +=head1 AUTHORS + +The MailTools bundle was developed by Graham Barr. Later, Mark +Overmeer took over maintenance without commitment to further development. + +Mail::Cap by Gisle Aas E<lt>aas@oslonett.noE<gt>. +Mail::Field::AddrList by Peter Orbaek E<lt>poe@cit.dkE<gt>. +Mail::Mailer and Mail::Send by Tim Bunce E<lt>Tim.Bunce@ig.co.ukE<gt>. +For other contributors see ChangeLog. + +=head1 LICENSE + +Copyrights 1995-2000 Graham Barr E<lt>gbarr@pobox.comE<gt> and +2001-2017 Mark Overmeer E<lt>perl@overmeer.netE<gt>. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. +See F<http://www.perl.com/perl/misc/Artistic.html> + diff --git a/cpan/lib/Mail/Field/Generic.pm b/cpan/lib/Mail/Field/Generic.pm new file mode 100644 index 00000000..2a9d193c --- /dev/null +++ b/cpan/lib/Mail/Field/Generic.pm @@ -0,0 +1,33 @@ +# Copyrights 1995-2017 by [Mark Overmeer <perl@overmeer.net>]. +# For other contributors see ChangeLog. +# See the manual pages for details on the licensing terms. +# Pod stripped from pm file by OODoc 2.02. +package Mail::Field::Generic; +use vars '$VERSION'; +$VERSION = '2.19'; + + +use Carp; +use base 'Mail::Field'; + + +sub create +{ my ($self, %arg) = @_; + $self->{Text} = delete $arg{Text}; + + croak "Unknown options " . join(",", keys %arg) + if %arg; + + $self; +} + + +sub parse +{ my $self = shift; + $self->{Text} = shift || ""; + $self; +} + +sub stringify { shift->{Text} } + +1; diff --git a/cpan/lib/Mail/Field/Generic.pod b/cpan/lib/Mail/Field/Generic.pod new file mode 100644 index 00000000..cdb90560 --- /dev/null +++ b/cpan/lib/Mail/Field/Generic.pod @@ -0,0 +1,147 @@ +=encoding utf8 + +=head1 NAME + +Mail::Field::Generic - implementation for inspecific fields + +=head1 INHERITANCE + + Mail::Field::Generic + is a Mail::Field + +=head1 SYNOPSIS + + use Mail::Field; + my $field = Mail::Field->new('Subject', 'some subject text'); + my $field = Mail::Field->new(subject => 'some subject text'); + +=head1 DESCRIPTION + +A generic implementation for header fields without own +implementation. This is fine for fields like C<Subject>, C<X-Mailer>, +etc., where the field holds only a string of no particular +importance/format. + +Extends L<"DESCRIPTION" in Mail::Field|Mail::Field/"DESCRIPTION">. + +=head1 METHODS + +Extends L<"METHODS" in Mail::Field|Mail::Field/"METHODS">. + +=head2 Constructors + +Extends L<"Constructors" in Mail::Field|Mail::Field/"Constructors">. + +=over 4 + +=item Mail::Field::Generic-E<gt>B<combine>(FIELDS) + +Inherited, see L<Mail::Field/"Constructors"> + +=item Mail::Field::Generic-E<gt>B<extract>( TAG, HEAD [, INDEX ] ) + +Inherited, see L<Mail::Field/"Constructors"> + +=item Mail::Field::Generic-E<gt>B<new>( TAG [, STRING | OPTIONS] ) + +Inherited, see L<Mail::Field/"Constructors"> + +=back + +=head2 "Fake" constructors + +Extends L<""Fake" constructors" in Mail::Field|Mail::Field/""Fake" constructors">. + +=over 4 + +=item $obj-E<gt>B<create>(OPTIONS) + + -Option--Default + Text '' + +=over 2 + +=item Text => STRING + +=back + +=item $obj-E<gt>B<parse>( [STRING] ) + +Set the new text, which is empty when no STRING is provided. + +=back + +=head2 Accessors + +Extends L<"Accessors" in Mail::Field|Mail::Field/"Accessors">. + +=over 4 + +=item $obj-E<gt>B<set>(OPTIONS) + +Inherited, see L<Mail::Field/"Accessors"> + +=item $obj-E<gt>B<stringify>() + +Inherited, see L<Mail::Field/"Accessors"> + +=item $obj-E<gt>B<tag>() + +=item Mail::Field::Generic-E<gt>B<tag>() + +Inherited, see L<Mail::Field/"Accessors"> + +=back + +=head2 Smart accessors + +Extends L<"Smart accessors" in Mail::Field|Mail::Field/"Smart accessors">. + +=over 4 + +=item $obj-E<gt>B<text>( [STRING] ) + +Inherited, see L<Mail::Field/"Smart accessors"> + +=back + +=head1 DETAILS + +Extends L<"DETAILS" in Mail::Field|Mail::Field/"DETAILS">. + +=head1 DIAGNOSTICS + +=over 4 + +=item Error: Undefined subroutine <method> called + +Mail::Field objects use autoloading to compile new functionality. +Apparently, the method called is not implemented for the specific +class of the field object. + +=back + +=head1 SEE ALSO + +This module is part of the MailTools distribution, +F<http://perl.overmeer.net/mailtools/>. + +=head1 AUTHORS + +The MailTools bundle was developed by Graham Barr. Later, Mark +Overmeer took over maintenance without commitment to further development. + +Mail::Cap by Gisle Aas E<lt>aas@oslonett.noE<gt>. +Mail::Field::AddrList by Peter Orbaek E<lt>poe@cit.dkE<gt>. +Mail::Mailer and Mail::Send by Tim Bunce E<lt>Tim.Bunce@ig.co.ukE<gt>. +For other contributors see ChangeLog. + +=head1 LICENSE + +Copyrights 1995-2000 Graham Barr E<lt>gbarr@pobox.comE<gt> and +2001-2017 Mark Overmeer E<lt>perl@overmeer.netE<gt>. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. +See F<http://www.perl.com/perl/misc/Artistic.html> + diff --git a/cpan/lib/Mail/Filter.pod b/cpan/lib/Mail/Filter.pod new file mode 100644 index 00000000..e4397c72 --- /dev/null +++ b/cpan/lib/Mail/Filter.pod @@ -0,0 +1,106 @@ +=encoding utf8 + +=head1 NAME + +Mail::Filter - filter mail through multiple subroutines + +=head1 SYNOPSIS + + use Mail::Filter; + + my $filter = Mail::Filter->new( \&filter1, \&filter2 ); + + my $mail = Mail::Internet->new( [<>] ); + my $mail = $filter->filter($mail); + + my $folder = Mail::Folder->new( .... ); + my $filter->filter($folder); + +=head1 DESCRIPTION + +C<Mail::Filter> provides an interface to filtering Email through multiple +subroutines. + +C<Mail::Filter> filters mail by calling each filter subroutine in turn. Each +filter subroutine is called with two arguments, the first is the filter +object and the second is the mail or folder object being filtered. + +The result from each filter sub is passed to the next filter as the mail +object. If a filter subroutine returns undef, then C<Mail::Filter> will abort +and return immediately. + +The function returns the result from the last subroutine to operate on the +mail object. + +=head1 METHODS + +=head2 Constructors + +=over 4 + +=item Mail::Filter-E<gt>B<new>( [FILTER [, ... ]] ) + +Create a new C<Mail::Filter> object with the given filter subroutines. Each +filter may be either a code reference or the name of a method to call +on the <Mail::Filter> object. + +=back + +=head2 Accessors + +=over 4 + +=item $obj-E<gt>B<add>( FILTER [, FILTER ...] ) + +Add the given filters to the end of the filter list. + +=back + +=head2 Processing + +=over 4 + +=item $obj-E<gt>B<filter>(MAIL-OBJECT | MAIL-FOLDER) + +If the first argument is a C<Mail::Internet> object, then this object will +be passed through the filter list. If the first argument is a C<Mail::Folder> +object, then each message in turn will be passed through the filter list. + +=item $obj-E<gt>B<folder>() + +While the C<filter> method is called with a C<Mail::Folder> object, these +filter subroutines can call this method to obtain the folder object that is +being processed. + +=item $obj-E<gt>B<msgnum>() + +If the C<filter> method is called with a C<Mail::Folder> object, then the +filter subroutines may call this method to obtain the message number +of the message that is being processed. + +=back + +=head1 SEE ALSO + +This module is part of the MailTools distribution, +F<http://perl.overmeer.net/mailtools/>. + +=head1 AUTHORS + +The MailTools bundle was developed by Graham Barr. Later, Mark +Overmeer took over maintenance without commitment to further development. + +Mail::Cap by Gisle Aas E<lt>aas@oslonett.noE<gt>. +Mail::Field::AddrList by Peter Orbaek E<lt>poe@cit.dkE<gt>. +Mail::Mailer and Mail::Send by Tim Bunce E<lt>Tim.Bunce@ig.co.ukE<gt>. +For other contributors see ChangeLog. + +=head1 LICENSE + +Copyrights 1995-2000 Graham Barr E<lt>gbarr@pobox.comE<gt> and +2001-2017 Mark Overmeer E<lt>perl@overmeer.netE<gt>. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. +See F<http://www.perl.com/perl/misc/Artistic.html> + diff --git a/cpan/lib/Mail/Header.pod b/cpan/lib/Mail/Header.pod new file mode 100644 index 00000000..9f90f4f8 --- /dev/null +++ b/cpan/lib/Mail/Header.pod @@ -0,0 +1,255 @@ +=encoding utf8 + +=head1 NAME + +Mail::Header - manipulate MIME headers + +=head1 SYNOPSIS + + use Mail::Header; + + my $head = Mail::Header->new; + my $head = Mail::Header->new( \*STDIN ); + my $head = Mail::Header->new( [<>], Modify => 0); + +=head1 DESCRIPTION + +Read, write, create, and manipulate MIME headers, the leading part +of each modern e-mail message, but also used in other protocols +like HTTP. The fields are kept in L<Mail::Field|Mail::Field> objects. + +Be aware that the header fields each have a name part, which shall +be treated case-insensitive, and a content part, which may be folded +over multiple lines. + +Mail::Header does not always follow the RFCs strict enough, does not +help you with character encodings. It does not use weak references +where it could (because those did not exist when the module was written) +which costs some performance and make the implementation a little more +complicated. The Mail::Message::Head implementation is much newer +and therefore better. + +=head1 METHODS + +=head2 Constructors + +=over 4 + +=item $obj-E<gt>B<dup>() + +Create a duplicate of the current object. + +=item $obj-E<gt>B<new>( [ARG], [OPTIONS] ) + +=item Mail::Header-E<gt>B<new>( [ARG], [OPTIONS] ) + +ARG may be either a file descriptor (reference to a GLOB) +or a reference to an array. If given the new object will be +initialized with headers either from the array of read from +the file descriptor. + +OPTIONS is a list of options given in the form of key-value +pairs, just like a hash table. Valid options are + + -Option --Default + FoldLength 79 + MailFrom 'KEEP' + Modify false + +=over 2 + +=item FoldLength => INTEGER + +The default length of line to be used when folding header lines. +See L<fold_length()|Mail::Header/"Accessors">. + +=item MailFrom => 'IGNORE'|'COERCE'|'KEEP'|'ERROR' + +See method L<mail_from()|Mail::Header/"Accessors">. + +=item Modify => BOOLEAN + +If this value is I<true> then the headers will be re-formatted, +otherwise the format of the header lines will remain unchanged. + +=back + +=back + +=head2 "Fake" constructors + +Be warned that the next constructors all require an already created +header object, of which the original content will be destroyed. + +=over 4 + +=item $obj-E<gt>B<empty>() + +Empty an existing C<Mail::Header> object of all lines. + +=item $obj-E<gt>B<extract>(ARRAY) + +Extract a header from the given array into an existing Mail::Header +object. C<extract> B<will modify> this array. +Returns the object that the method was called on. + +=item $obj-E<gt>B<header>( [ARRAY] ) + +C<header> does multiple operations. First it will extract a header from +the ARRAY, if given. It will then reformat the header (if reformatting +is permitted), and finally return a reference to an array which +contains the header in a printable form. + +=item $obj-E<gt>B<header_hashref>( [HASH] ) + +As L<header()|Mail::Header/""Fake" constructors">, but it will eventually set headers from a hash +reference, and it will return the headers as a hash reference. + +example: + + $fields->{From} = 'Tobias Brox <tobix@cpan.org>'; + $fields->{To} = ['you@somewhere', 'me@localhost']; + $head->header_hashref($fields); + +=item $obj-E<gt>B<read>(FILEHANDLE) + +Read a header from the given file descriptor into an existing Mail::Header +object. + +=back + +=head2 Accessors + +=over 4 + +=item $obj-E<gt>B<fold_length>( [TAG], [LENGTH] ) + +Set the default fold length for all tags or just one. With no arguments +the default fold length is returned. With two arguments it sets the fold +length for the given tag and returns the previous value. If only C<LENGTH> +is given it sets the default fold length for the current object. + +In the two argument form C<fold_length> may be called as a static method, +setting default fold lengths for tags that will be used by B<all> +C<Mail::Header> objects. See the C<fold> method for +a description on how C<Mail::Header> uses these values. + +=item $obj-E<gt>B<mail_from>('IGNORE'|'COERCE'|'KEEP'|'ERROR') + +This specifies what to do when a C<`From '> line is encountered. +Valid values are C<IGNORE> - ignore and discard the header, +C<ERROR> - invoke an error (call die), C<COERCE> - rename them as Mail-From +and C<KEEP> - keep them. + +=item $obj-E<gt>B<modify>( [VALUE] ) + +If C<VALUE> is I<false> then C<Mail::Header> will not do any automatic +reformatting of the headers, other than to ensure that the line +starts with the tags given. + +=back + +=head2 Processing + +=over 4 + +=item $obj-E<gt>B<add>( TAG, LINE [, INDEX] ) + +Add a new line to the header. If TAG is C<undef> the tag will be +extracted from the beginning of the given line. If INDEX is given, +the new line will be inserted into the header at the given point, otherwise +the new line will be appended to the end of the header. + +=item $obj-E<gt>B<as_string>() + +Returns the header as a single string. + +=item $obj-E<gt>B<cleanup>() + +Remove any header line that, other than the tag, only contains whitespace + +=item $obj-E<gt>B<combine>( TAG [, WITH] ) + +Combine all instances of TAG into one. The lines will be +joined together WITH, or a single space if not given. The new +item will be positioned in the header where the first instance was, all +other instances of TAG will be removed. + +=item $obj-E<gt>B<count>(TAG) + +Returns the number of times the given atg appears in the header + +=item $obj-E<gt>B<delete>( TAG [, INDEX ] ) + +Delete a tag from the header. If an INDEX id is given, then the Nth instance +of the tag will be removed. If no INDEX is given, then all instances +of tag will be removed. + +=item $obj-E<gt>B<fold>( [LENGTH] ) + +Fold the header. If LENGTH is not given, then C<Mail::Header> uses the +following rules to determine what length to fold a line. + +=item $obj-E<gt>B<get>( TAG [, INDEX] ) + +Get the text from a line. If an INDEX is given, then the text of the Nth +instance will be returned. If it is not given the return value depends on the +context in which C<get> was called. In an array context a list of all the +text from all the instances of the TAG will be returned. In a scalar context +the text for the first instance will be returned. + +The lines are unfolded, but still terminated with a new-line (see C<chomp>) + +=item $obj-E<gt>B<print>( [FILEHANDLE] ) + +Print the header to the given file descriptor, or C<STDOUT> if no +file descriptor is given. + +=item $obj-E<gt>B<replace>( TAG, LINE [, INDEX ] ) + +Replace a line in the header. If TAG is C<undef> the tag will be +extracted from the beginning of the given line. If INDEX is given +the new line will replace the Nth instance of that tag, otherwise the +first instance of the tag is replaced. If the tag does not appear in the +header then a new line will be appended to the header. + +=item $obj-E<gt>B<tags>() + +Returns an array of all the tags that exist in the header. Each tag will +only appear in the list once. The order of the tags is not specified. + +=item $obj-E<gt>B<unfold>( [TAG] ) + +Unfold all instances of the given tag so that they do not spread across +multiple lines. If C<TAG> is not given then all lines are unfolded. + +The unfolding process is wrong but (for compatibility reasons) will +not be repaired: only one blank at the start of the line should be +removed, not all of them. + +=back + +=head1 SEE ALSO + +This module is part of the MailTools distribution, +F<http://perl.overmeer.net/mailtools/>. + +=head1 AUTHORS + +The MailTools bundle was developed by Graham Barr. Later, Mark +Overmeer took over maintenance without commitment to further development. + +Mail::Cap by Gisle Aas E<lt>aas@oslonett.noE<gt>. +Mail::Field::AddrList by Peter Orbaek E<lt>poe@cit.dkE<gt>. +Mail::Mailer and Mail::Send by Tim Bunce E<lt>Tim.Bunce@ig.co.ukE<gt>. +For other contributors see ChangeLog. + +=head1 LICENSE + +Copyrights 1995-2000 Graham Barr E<lt>gbarr@pobox.comE<gt> and +2001-2017 Mark Overmeer E<lt>perl@overmeer.netE<gt>. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. +See F<http://www.perl.com/perl/misc/Artistic.html> + diff --git a/cpan/lib/Mail/Internet.pod b/cpan/lib/Mail/Internet.pod new file mode 100644 index 00000000..a6c42b7f --- /dev/null +++ b/cpan/lib/Mail/Internet.pod @@ -0,0 +1,387 @@ +=encoding utf8 + +=head1 NAME + +Mail::Internet - manipulate email messages + +=head1 SYNOPSIS + + use Mail::Internet; + my $msg = Mail::Internet->new(\*STDIN); + +=head1 DESCRIPTION + +This package implements reading, creating, manipulating, and writing email +messages. Sometimes, the implementation tries to be too smart, but in +the general case it works as expected. + +If you start writing a B<new application>, you should use the L<Mail::Box> +distribution, which has more features and handles messages much better +according to the RFCs. See L<http://perl.overmeer.net/mailbox/>. +You may also chose L<MIME::Entity>, to get at least some multipart +support in your application. + +=head1 METHODS + +=head2 Constructors + +=over 4 + +=item $obj-E<gt>B<dup>() + +Duplicate the message as a whole. Both header and body will be +deep-copied: a new L<Mail::Internet|Mail::Internet> object is returned. + +=item $obj-E<gt>B<extract>(ARRAY-of-LINES) + +Extract header and body from an ARRAY of message lines. Requires an +object already created with L<new()|Mail::Internet/"Constructors">, which contents will get overwritten. + +=item $obj-E<gt>B<new>( [ARG], [OPTIONS] ) + +=item Mail::Internet-E<gt>B<new>( [ARG], [OPTIONS] ) + +ARG is optional and may be either a file descriptor (reference to a GLOB) +or a reference to an array. If given the new object will be +initialized with headers and body either from the array of read from +the file descriptor. + +The L<Mail::Header::new()|Mail::Header/"Constructors"> OPTIONS C<Modify>, C<MailFrom> and C<FoldLength> +may also be given. + + -Option--Default + Body [] + Header undef + +=over 2 + +=item Body => ARRAY-of-LINES + +The value of this option should be a reference to an array which contains +the lines for the body of the message. Each line should be terminated with +C<\n> (LF). If Body is given then C<Mail::Internet> will not attempt to +read the body from C<ARG> (even if it is specified). + +=item Header => Mail::Header + +The value of this option should be a L<Mail::Header|Mail::Header> object. If given then +C<Mail::Internet> will not attempt to read a mail header from C<ARG>, if +it was specified. + +=back + +=item $obj-E<gt>B<read>(FILEHANDLE) + +Read a message from the FILEHANDLE into an already existing message +object. Better use L<new()|Mail::Internet/"Constructors"> with the FILEHANDLE as first argument. + +=back + +=head2 Accessors + +=over 4 + +=item $obj-E<gt>B<body>( [BODY] ) + +Returns the body of the message. This is a reference to an array. +Each entry in the array represents a single line in the message. + +If I<BODY> is given, it can be a reference to an array or an array, then +the body will be replaced. If a reference is passed, it is used directly +and not copied, so any subsequent changes to the array will change the +contents of the body. + +=item $obj-E<gt>B<head>() + +Returns the C<Mail::Header> object which holds the headers for the current +message + +=back + +=head2 Processing the message as a whole + +=over 4 + +=item $obj-E<gt>B<as_mbox_string>( [ALREADY_ESCAPED] ) + +Returns the message as a string in mbox format. C<ALREADY_ESCAPED>, if +given and true, indicates that L<escape_from()|Mail::Internet/"High-level functionality"> has already been called on +this object. + +=item $obj-E<gt>B<as_string>() + +Returns the message as a single string. + +=item $obj-E<gt>B<print>( [FILEHANDLE] ) + +Print the header, body or whole message to file descriptor I<FILEHANDLE>. +I<$fd> should be a reference to a GLOB. If I<FILEHANDLE> is not given the +output will be sent to STDOUT. + +example: + + $mail->print( \*STDOUT ); # Print message to STDOUT + +=item $obj-E<gt>B<print_body>( [FILEHANDLE] ) + +Print only the body to the FILEHANDLE (default STDOUT). + +=item $obj-E<gt>B<print_header>( [FILEHANDLE] ) + +Print only the header to the FILEHANDLE (default STDOUT). + +=back + +=head2 Processing the header + +Most of these methods are simply wrappers around methods provided +by L<Mail::Header|Mail::Header>. + +=over 4 + +=item $obj-E<gt>B<add>(PAIRS-of-FIELD) + +The PAIRS are field-name and field-content. For each PAIR, +L<Mail::Header::add()|Mail::Header/"Processing"> is called. All fields are added after +existing fields. The last addition is returned. + +=item $obj-E<gt>B<combine>( TAG, [WITH] ) + +See L<Mail::Header::combine()|Mail::Header/"Processing">. + +=item $obj-E<gt>B<delete>( TAG, [TAGs] ) + +Delete all fields with the name TAG. L<Mail::Header::delete()|Mail::Header/"Processing"> is doing the +work. + +=item $obj-E<gt>B<fold>( [LENGTH] ) + +See L<Mail::Header::fold()|Mail::Header/"Processing">. + +=item $obj-E<gt>B<fold_length>( [TAG], [LENGTH] ) + +See L<Mail::Header::fold_length()|Mail::Header/"Accessors">. + +=item $obj-E<gt>B<get>( TAG, [TAGs] ) + +In LIST context, all fields with the name TAG are returned. In SCALAR +context, only the first field which matches the earliest TAG is returned. +L<Mail::Header::get()|Mail::Header/"Processing"> is called to collect the data. + +=item $obj-E<gt>B<header>( [ARRAY-of-LINES] ) + +See L<Mail::Header::header()|Mail::Header/""Fake" constructors">. + +=item $obj-E<gt>B<replace>(PAIRS-of-FIELD) + +The PAIRS are field-name and field-content. For each PAIR, +L<Mail::Header::replace()|Mail::Header/"Processing"> is called with INDEX 0. If a FIELD is already +in the header, it will be removed first. Do not specified the same +field-name twice. + +=back + +=head2 Processing the body + +=over 4 + +=item $obj-E<gt>B<remove_sig>( [NLINES] ) + +Attempts to remove a users signature from the body of a message. It does this +by looking for a line equal to C<'-- '> within the last C<NLINES> of the +message. If found then that line and all lines after it will be removed. If +C<NLINES> is not given a default value of 10 will be used. This would be of +most use in auto-reply scripts. + +=item $obj-E<gt>B<sign>(OPTIONS) + +Add your signature to the body. L<remove_sig()|Mail::Internet/"Processing the body"> will strip existing +signatures first. + + -Option --Default + File undef + Signature [] + +=over 2 + +=item File => FILEHANDLE + +Take from the FILEHANDLE all lines starting from the first C<< -- >>. + +=item Signature => STRING|ARRAY-of-LINES + +=back + +=item $obj-E<gt>B<tidy_body>() + +Removes all leading and trailing lines from the body that only contain +white spaces. + +=back + +=head2 High-level functionality + +=over 4 + +=item $obj-E<gt>B<escape_from>() + +It can cause problems with some applications if a message contains a line +starting with C<`From '>, in particular when attempting to split a folder. +This method inserts a leading C<`>'> on any line that matches the regular +expression C</^>*From/> + +=item $obj-E<gt>B<nntppost>( [OPTIONS] ) + +Post an article via NNTP. Requires Net::NNTP to be installed. + + -Option--Default + Debug <false> + Host <required> + Port 119 + +=over 2 + +=item Debug => BOOLEAN + +Debug value to pass to Net::NNTP, see L<Net::NNTP> + +=item Host => HOSTNAME|Net::NNTP object + +Name of NNTP server to connect to, or a Net::NNTP object to use. + +=item Port => INTEGER + +Port number to connect to on remote host + +=back + +=item $obj-E<gt>B<reply>(OPTIONS) + +Create a new object with header initialised for a reply to the current +object. And the body will be a copy of the current message indented. + +The C<.mailhdr> file in your home directory (if exists) will be read +first, to provide defaults. + + -Option --Default + Exclude [] + Indent '>' + Keep [] + ReplyAll false + +=over 2 + +=item Exclude => ARRAY-of-FIELDS + +Remove the listed FIELDS from the produced message. + +=item Indent => STRING + +Use as indentation string. The string may contain C<%%> to get a single C<%>, +C<%f> to get the first from name, C<%F> is the first character of C<%f>, +C<%l> is the last name, C<%L> its first character, C<%n> the whole from +string, and C<%I> the first character of each of the names in the from string. + +=item Keep => ARRAY-of-FIELDS + +Copy the listed FIELDS from the original message. + +=item ReplyAll => BOOLEAN + +Automatically include all To and Cc addresses of the original mail, +excluding those mentioned in the Bcc list. + +=back + +=item $obj-E<gt>B<send>( [TYPE, [ARGS...]] ) + +Send a Mail::Internet message using L<Mail::Mailer|Mail::Mailer>. TYPE and ARGS are +passed on to L<Mail::Mailer::new()|Mail::Mailer/"Constructors">. + +=item $obj-E<gt>B<smtpsend>( [OPTIONS] ) + +Send a Mail::Internet message using direct SMTP. to the given +ADDRESSES, each can be either a string or a reference to a list of email +addresses. If none of C<To>, <Cc> or C<Bcc> are given then the addresses +are extracted from the message being sent. + +The return value will be a list of email addresses that the message was sent +to. If the message was not sent the list will be empty. + +Requires Net::SMTP and Net::Domain to be installed. + + -Option --Default + Bcc undef + Cc undef + Debug <false> + Hello localhost.localdomain + Host $ENV{SMTPHOSTS} + MailFrom Mail::Util::mailaddress() + Port 25 + To undef + +=over 2 + +=item Bcc => ADDRESSES + +=item Cc => ADDRESSES + +=item Debug => BOOLEAN + +Debug value to pass to Net::SMPT, see <Net::SMTP> + +=item Hello => STRING + +Send a HELO (or EHLO) command to the server with the given name. + +=item Host => HOSTNAME + +Name of the SMTP server to connect to, or a Net::SMTP object to use + +If C<Host> is not given then the SMTP host is found by attempting +connections first to hosts specified in C<$ENV{SMTPHOSTS}>, a colon +separated list, then C<mailhost> and C<localhost>. + +=item MailFrom => ADDRESS + +The e-mail address which is used as sender. By default, +L<Mail::Util::mailaddress()|Mail::Util/"FUNCTIONS"> provides the address of the sender. + +=item Port => INTEGER + +Port number to connect to on remote host + +=item To => ADDRESSES + +=back + +=item $obj-E<gt>B<unescape_from>(()) + +Remove the escaping added by L<escape_from()|Mail::Internet/"High-level functionality">. + +=back + +=head1 SEE ALSO + +This module is part of the MailTools distribution, +F<http://perl.overmeer.net/mailtools/>. + +=head1 AUTHORS + +The MailTools bundle was developed by Graham Barr. Later, Mark +Overmeer took over maintenance without commitment to further development. + +Mail::Cap by Gisle Aas E<lt>aas@oslonett.noE<gt>. +Mail::Field::AddrList by Peter Orbaek E<lt>poe@cit.dkE<gt>. +Mail::Mailer and Mail::Send by Tim Bunce E<lt>Tim.Bunce@ig.co.ukE<gt>. +For other contributors see ChangeLog. + +=head1 LICENSE + +Copyrights 1995-2000 Graham Barr E<lt>gbarr@pobox.comE<gt> and +2001-2017 Mark Overmeer E<lt>perl@overmeer.netE<gt>. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. +See F<http://www.perl.com/perl/misc/Artistic.html> + diff --git a/cpan/lib/Mail/Mailer.pod b/cpan/lib/Mail/Mailer.pod new file mode 100644 index 00000000..7b9c63f9 --- /dev/null +++ b/cpan/lib/Mail/Mailer.pod @@ -0,0 +1,152 @@ +=encoding utf8 + +=head1 NAME + +Mail::Mailer - send simple emails + +=head1 INHERITANCE + + Mail::Mailer + is a IO::Handle + +=head1 SYNOPSIS + + use Mail::Mailer; + use Mail::Mailer qw(mail); # specifies default mailer + + $mailer = Mail::Mailer->new; + $mailer = Mail::Mailer->new($type, @args); + + $mailer->open(\%headers); + print $mailer $body; + $mailer->close + or die "couldn't send whole message: $!\n"; + +=head1 DESCRIPTION + +Sends mail using any of the built-in methods. As TYPE argument +to L<new()|Mail::Mailer/"Constructors">, you can specify any of + +=over 4 + +=item C<sendmail> + +Use the C<sendmail> program to deliver the mail. + +=item C<smtp> + +Use the C<smtp> protocol via Net::SMTP to deliver the mail. The server +to use can be specified in C<@args> with + + $mailer = Mail::Mailer->new('smtp', Server => $server); + +The smtp mailer does not handle C<Cc> and C<Bcc> lines, neither their +C<Resent-*> fellows. The C<Debug> options enables debugging output +from C<Net::SMTP>. + +You may also use the C<< Auth => [ $user, $password ] >> option for SASL +authentication. To make this work, you have to install the L<Authen::SASL> +distribution yourself: it is not automatically installed. + +=item C<smtps> + +Use the smtp over ssl protocol via L<Net::SMTP::SSL> to deliver the mail. +Usage is identical to C<smtp>. You have to install Authen::SASL as +well. + + $mailer = Mail::Mailer->new('smtps', Server => $server); + +=item C<qmail> + +Use qmail's qmail-inject program to deliver the mail. + +=item C<testfile> + +Used for debugging, this displays the data to the file named in +C<$Mail::Mailer::testfile::config{outfile}> which defaults to a file +named C<mailer.testfile>. No mail is ever sent. + +=back + +C<Mail::Mailer> will search for executables in the above order. The +default mailer will be the first one found. + +=head1 METHODS + +=head2 Constructors + +=over 4 + +=item Mail::Mailer-E<gt>B<new>(TYPE, ARGS) + +The TYPE is one of the back-end sender implementations, as described in +the DESCRIPTION chapter of this manual page. The ARGS are passed to +that back-end. + +=item $obj-E<gt>B<open>(HASH) + +The HASH consists of key and value pairs, the key being the name of +the header field (eg, C<To>), and the value being the corresponding +contents of the header field. The value can either be a scalar +(eg, C<gnat@frii.com>) or a reference to an array of scalars +(C<< eg, ['gnat@frii.com', 'Tim.Bunce@ig.co.uk'] >>). + +=back + +=head1 DETAILS + +=head2 ENVIRONMENT VARIABLES + +=over 4 + +=item PERL_MAILERS + +Augments/override the build in choice for binary used to send out +our mail messages. + +Format: + + "type1:mailbinary1;mailbinary2;...:type2:mailbinaryX;...:..." + +Example: assume you want you use private sendmail binary instead +of mailx, one could set C<PERL_MAILERS> to: + + "mail:/does/not/exists:sendmail:$HOME/test/bin/sendmail" + +On systems which may include C<:> in file names, use C<|> as separator +between type-groups. + + "mail:c:/does/not/exists|sendmail:$HOME/test/bin/sendmail" + +=back + +=head2 BUGS + +Mail::Mailer does not help with folding, and does not protect +against various web-script hacker attacks, for instance where +a new-line is inserted in the content of the field. + +=head1 SEE ALSO + +This module is part of the MailTools distribution, +F<http://perl.overmeer.net/mailtools/>. + +=head1 AUTHORS + +The MailTools bundle was developed by Graham Barr. Later, Mark +Overmeer took over maintenance without commitment to further development. + +Mail::Cap by Gisle Aas E<lt>aas@oslonett.noE<gt>. +Mail::Field::AddrList by Peter Orbaek E<lt>poe@cit.dkE<gt>. +Mail::Mailer and Mail::Send by Tim Bunce E<lt>Tim.Bunce@ig.co.ukE<gt>. +For other contributors see ChangeLog. + +=head1 LICENSE + +Copyrights 1995-2000 Graham Barr E<lt>gbarr@pobox.comE<gt> and +2001-2017 Mark Overmeer E<lt>perl@overmeer.netE<gt>. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. +See F<http://www.perl.com/perl/misc/Artistic.html> + diff --git a/cpan/lib/Mail/Mailer/smtps.pm b/cpan/lib/Mail/Mailer/smtps.pm new file mode 100644 index 00000000..90d10efc --- /dev/null +++ b/cpan/lib/Mail/Mailer/smtps.pm @@ -0,0 +1,108 @@ +# Copyrights 1995-2017 by [Mark Overmeer <perl@overmeer.net>]. +# For other contributors see ChangeLog. +# See the manual pages for details on the licensing terms. +# Pod stripped from pm file by OODoc 2.02. +# Based on smtp.pm, adapted by Maciej Żenczykowski + +use strict; + +package Mail::Mailer::smtps; +use vars '$VERSION'; +$VERSION = '2.19'; + +use base 'Mail::Mailer::rfc822'; + +use Net::SMTP::SSL; +use Mail::Util qw(mailaddress); +use Carp; + +sub can_cc { 0 } + +sub exec { + my ($self, $exe, $args, $to) = @_; + my %opt = @$args; + my $host = $opt{Server} || undef; + $opt{Debug} ||= 0; + $opt{Port} ||= 465; + + my $smtp = Net::SMTP::SSL->new($host, %opt) + or return undef; + + if($opt{Auth}) + { $smtp->auth(@{$opt{Auth}}) + or return undef; + } + + ${*$self}{sock} = $smtp; + + $smtp->mail($opt{From} || mailaddress); + $smtp->to($_) for @$to; + $smtp->data; + + untie *$self if tied *$self; + tie *$self, 'Mail::Mailer::smtps::pipe', $self; + $self; +} + +sub set_headers($) +{ my ($self, $hdrs) = @_; + $self->SUPER::set_headers + ( { From => "<" . mailaddress() . ">" + , %$hdrs + , 'X-Mailer' => "Mail::Mailer[v$Mail::Mailer::VERSION] " + . " Net::SMTP[v$Net::SMTP::VERSION]" + . " Net::SMTP::SSL[v$Net::SMTP::SSL::VERSION]" + } + ); +} + +sub epilogue() +{ my $self = shift; + my $sock = ${*$self}{sock}; + + my $ok = $sock->dataend; + $sock->quit; + + delete ${*$self}{sock}; + untie *$self; + $ok; +} + +sub close(@) +{ my ($self, @to) = @_; + my $sock = ${*$self}{sock}; + + $sock && fileno $sock + or return 1; + + my $ok = $self->epilogue; + + # Epilogue should destroy the SMTP filehandle, + # but just to be on the safe side. + $sock && fileno $sock + or return $ok; + + close $sock + or croak 'Cannot destroy socket filehandle'; + + $ok; +} + +package Mail::Mailer::smtps::pipe; +use vars '$VERSION'; +$VERSION = '2.19'; + + +sub TIEHANDLE +{ my ($class, $self) = @_; + my $sock = ${*$self}{sock}; + bless \$sock, $class; +} + +sub PRINT +{ my $self = shift; + my $sock = $$self; + $sock->datasend( @_ ); +} + +1; diff --git a/cpan/lib/Mail/Mailer/testfile.pm b/cpan/lib/Mail/Mailer/testfile.pm new file mode 100644 index 00000000..94dcad40 --- /dev/null +++ b/cpan/lib/Mail/Mailer/testfile.pm @@ -0,0 +1,54 @@ +# Copyrights 1995-2017 by [Mark Overmeer <perl@overmeer.net>]. +# For other contributors see ChangeLog. +# See the manual pages for details on the licensing terms. +# Pod stripped from pm file by OODoc 2.02. +use strict; + +package Mail::Mailer::testfile; +use vars '$VERSION'; +$VERSION = '2.19'; + +use base 'Mail::Mailer::rfc822'; + +use Mail::Util qw/mailaddress/; + +my $num = 0; +sub can_cc() { 0 } + +sub exec($$$) +{ my ($self, $exe, $args, $to) = @_; + + my $outfn = $Mail::Mailer::testfile::config{outfile} || 'mailer.testfile'; + open F, '>>', $outfn + or die "Cannot append message to testfile $outfn: $!"; + + print F "\n===\ntest ", ++$num, " ", (scalar localtime), + "\nfrom: " . mailaddress(), + "\nto: " . join(' ',@{$to}), "\n\n"; + close F; + + untie *$self if tied *$self; + tie *$self, 'Mail::Mailer::testfile::pipe', $self; + $self; +} + +sub close { 1 } + +package Mail::Mailer::testfile::pipe; +use vars '$VERSION'; +$VERSION = '2.19'; + + +sub TIEHANDLE +{ my ($class, $self) = @_; + bless \$self, $class; +} + +sub PRINT +{ my $self = shift; + open F, '>>', $Mail::Mailer::testfile::config{outfile} || 'mailer.testfile'; + print F @_; + close F; +} + +1; diff --git a/cpan/lib/Mail/Send.pod b/cpan/lib/Mail/Send.pod new file mode 100644 index 00000000..bda52154 --- /dev/null +++ b/cpan/lib/Mail/Send.pod @@ -0,0 +1,116 @@ +=encoding utf8 + +=head1 NAME + +Mail::Send - Simple electronic mail interface + +=head1 SYNOPSIS + + require Mail::Send; + + $msg = Mail::Send->new; + $msg = Mail::Send->new(Subject => 'example', To => 'timbo'); + + $msg->to('user@host'); + $msg->to('user@host', 'user2@example.com'); + $msg->subject('example subject'); + $msg->cc('user@host'); + $msg->bcc('someone@else'); + + $msg->set($header, @values); + $msg->add($header, @values); + $msg->delete($header); + + # Launch mailer and set headers. The filehandle returned + # by open() is an instance of the Mail::Mailer class. + # Arguments to the open() method are passed to the Mail::Mailer + # constructor. + + $fh = $msg->open; # some default mailer + $fh = $msg->open('sendmail'); # explicit + print $fh "Body of message"; + $fh->close # complete the message and send it + or die "couldn't send whole message: $!\n"; + +=head1 DESCRIPTION + +L<Mail::Send|Mail::Send> creates e-mail messages without using the L<Mail::Header|Mail::Header> +knowledge, which means that all escaping and folding must be done by +you! Simplicity has its price. + +When you have time, take a look at Mail::Transport + +=head1 METHODS + +=head2 Constructors + +=over 4 + +=item Mail::Send-E<gt>B<new>(PAIRS) + +A list of header fields (provided as key-value PAIRS) can be +used to initialize the object. + +=back + +=head2 Header fields + +=over 4 + +=item $obj-E<gt>B<add>(FIELDNAME, VALUES) + +Add values to the list of defined values for the FIELDNAME. + +=item $obj-E<gt>B<bcc>(VALUES) + +=item $obj-E<gt>B<cc>(VALUES) + +=item $obj-E<gt>B<delete>(FIELDNAME) + +=item $obj-E<gt>B<set>(FIELDNAME, VALUES) + +VALUES will replace the old values for the FIELDNAME. Returned is +the LIST of values after modification. + +=item $obj-E<gt>B<subject>(VALUES) + +=item $obj-E<gt>B<to>(VALUES) + +=back + +=head2 Sending + +=over 4 + +=item $obj-E<gt>B<open>(OPTIONS) + +The OPTIONS are used to initiate a mailer object via +L<Mail::Mailer::new()|Mail::Mailer/"Constructors">. Then L<Mail::Mailer::open()|Mail::Mailer/"Constructors"> is called +with the knowledge collected in this Mail::Send object. + +=back + +=head1 SEE ALSO + +This module is part of the MailTools distribution, +F<http://perl.overmeer.net/mailtools/>. + +=head1 AUTHORS + +The MailTools bundle was developed by Graham Barr. Later, Mark +Overmeer took over maintenance without commitment to further development. + +Mail::Cap by Gisle Aas E<lt>aas@oslonett.noE<gt>. +Mail::Field::AddrList by Peter Orbaek E<lt>poe@cit.dkE<gt>. +Mail::Mailer and Mail::Send by Tim Bunce E<lt>Tim.Bunce@ig.co.ukE<gt>. +For other contributors see ChangeLog. + +=head1 LICENSE + +Copyrights 1995-2000 Graham Barr E<lt>gbarr@pobox.comE<gt> and +2001-2017 Mark Overmeer E<lt>perl@overmeer.netE<gt>. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. +See F<http://www.perl.com/perl/misc/Artistic.html> + diff --git a/cpan/lib/Mail/Util.pod b/cpan/lib/Mail/Util.pod new file mode 100644 index 00000000..8eb71268 --- /dev/null +++ b/cpan/lib/Mail/Util.pod @@ -0,0 +1,119 @@ +=encoding utf8 + +=head1 NAME + +Mail::Util - mail utility functions + +=head1 INHERITANCE + + Mail::Util + is a Exporter + +=head1 SYNOPSIS + + use Mail::Util qw( ... ); + +=head1 DESCRIPTION + +This package provides several mail related utility functions. Any function +required must by explicitly listed on the use line to be exported into +the calling package. + +=head1 FUNCTIONS + +=over 4 + +=item B<mailaddress>( [ADDRESS] ) + +Return a guess at the current users mail address. The user can force +the return value by setting the MAILADDRESS environment variable. +[2.10] You may set the ADDRESS via the parameter. + +WARNING: +When not supplied via the environment variable, <mailaddress> looks at +various configuration files and other environmental data. Although this +seems to be smart behavior, this is not predictable enough (IMHO) to +be used. Please set the MAILADDRESS explicitly, and do not trust on +the "automatic detection", even when that produces a correct address +(on the moment) + +example: + + # in your main script + $ENV{MAILADDRESS} = 'me@example.com'; + + # everywhere else + use Mail::Util 'mailaddress'; + print mailaddress; + + # since v2.10 + mailaddress "me@example.com"; + +=item B<maildomain>() + +Attempt to determine the current user mail domain string via the following +methods + +=over 4 + +=item * Look for the MAILDOMAIN environment variable, which can be set from outside the program. This is by far the best way to configure the domain. + +=item * Look for a sendmail.cf file and extract DH parameter + +=item * Look for a smail config file and usr the first host defined in hostname(s) + +=item * Try an SMTP connect (if Net::SMTP exists) first to mailhost then localhost + +=item * Use value from Net::Domain::domainname (if Net::Domain exists) + +=back + +WARNING: +On modern machines, there is only one good way to provide information to +this method: the first; always explicitly configure the MAILDOMAIN. + +example: + + # in your main script + $ENV{MAILDOMAIN} = 'example.com'; + + # everywhere else + use Mail::Util 'maildomain'; + print maildomain; + +=item B<read_mbox>(FILE) + +Read FILE, a binmail mailbox file, and return a list of references. +Each reference is a reference to an array containing one message. + +WARNING: +This method does not quote lines which accidentally also start with the +message separator C<From>, so this implementation can be considered +broken. See Mail::Box::Mbox + +=back + +=head1 SEE ALSO + +This module is part of the MailTools distribution, +F<http://perl.overmeer.net/mailtools/>. + +=head1 AUTHORS + +The MailTools bundle was developed by Graham Barr. Later, Mark +Overmeer took over maintenance without commitment to further development. + +Mail::Cap by Gisle Aas E<lt>aas@oslonett.noE<gt>. +Mail::Field::AddrList by Peter Orbaek E<lt>poe@cit.dkE<gt>. +Mail::Mailer and Mail::Send by Tim Bunce E<lt>Tim.Bunce@ig.co.ukE<gt>. +For other contributors see ChangeLog. + +=head1 LICENSE + +Copyrights 1995-2000 Graham Barr E<lt>gbarr@pobox.comE<gt> and +2001-2017 Mark Overmeer E<lt>perl@overmeer.netE<gt>. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. +See F<http://www.perl.com/perl/misc/Artistic.html> + diff --git a/cpan/lib/MailTools.pm b/cpan/lib/MailTools.pm new file mode 100644 index 00000000..77accb7d --- /dev/null +++ b/cpan/lib/MailTools.pm @@ -0,0 +1,11 @@ +# Copyrights 1995-2017 by [Mark Overmeer <perl@overmeer.net>]. +# For other contributors see ChangeLog. +# See the manual pages for details on the licensing terms. +# Pod stripped from pm file by OODoc 2.02. +package MailTools; +use vars '$VERSION'; +$VERSION = '2.19'; + + + +1; diff --git a/cpan/lib/MailTools.pod b/cpan/lib/MailTools.pod new file mode 100644 index 00000000..17d25a5f --- /dev/null +++ b/cpan/lib/MailTools.pod @@ -0,0 +1,92 @@ +=encoding utf8 + +=head1 NAME + +MailTools - bundle of ancient email modules + +=head1 SYNOPSIS + + # This is a place-holder for the distribution + +=head1 DESCRIPTION + +MailTools is a bundle: an ancient form of combining packages into one +distribution. Gladly, it can be distributed as if it is a normal +distribution as well. + +B<Be warned:> The code you find here is very old. It works for simple +emails, but when you start with new code then please use more +sofisticated libraries. The main reason that you still find this code +on CPAN, is because many books use it as example. + +=head2 Component + +In this distribution, you find + +=over 4 + +=item Mail::Address + +Parse email address from a header line. + +=item Mail::Cap + +Interpret mailcap files: mappings of file-types to applications as used +by many command-line email programs. + +=item Mail::Field + +Simplifies access to (some) email header fields. Used by L<Mail::Header|Mail::Header>. + +=item Mail::Filter + +Process L<Mail::Internet|Mail::Internet> messages. + +=item Mail::Header + +Collection of L<Mail::Field|Mail::Field> objects, representing the header of a +L<Mail::Internet|Mail::Internet> object. + +=item Mail::Internet + +Represents a single email message, with header and body. + +=item Mail::Mailer + +Send L<Mail::Internet|Mail::Internet> emails via direct smtp or local MTA's. + +=item Mail::Send + +Build a L<Mail::Internet|Mail::Internet> object, and then send it out using +L<Mail::Mailer|Mail::Mailer>. + +=item Mail::Util + +"Smart functions" you should not depend on. + +=back + +=head1 SEE ALSO + +This module is part of the MailTools distribution, +F<http://perl.overmeer.net/mailtools/>. + +=head1 AUTHORS + +The MailTools bundle was developed by Graham Barr. Later, Mark +Overmeer took over maintenance without commitment to further development. + +Mail::Cap by Gisle Aas E<lt>aas@oslonett.noE<gt>. +Mail::Field::AddrList by Peter Orbaek E<lt>poe@cit.dkE<gt>. +Mail::Mailer and Mail::Send by Tim Bunce E<lt>Tim.Bunce@ig.co.ukE<gt>. +For other contributors see ChangeLog. + +=head1 LICENSE + +Copyrights 1995-2000 Graham Barr E<lt>gbarr@pobox.comE<gt> and +2001-2017 Mark Overmeer E<lt>perl@overmeer.netE<gt>. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. +See F<http://www.perl.com/perl/misc/Artistic.html> + |
