Mail-Message

 view release on metacpan or  search on metacpan

lib/Mail/Message/Construct/Build.pm  view on Meta::CPAN

	  : $_[0]->isa('Mail::Message::Body') ? shift
	  :    ();

	my ($head, @headerlines);
	my ($type, $transfenc, $dispose, $descr, $cid, $lang);
	while(@_)
	{	my $key = shift;

		if(blessed $key && $key->isa('Mail::Message::Field'))
		{	my $name = $key->name;
			   if($name eq 'content-type')        { $type    = $key }
			elsif($name eq 'content-transfer-encoding') { $transfenc = $key }
			elsif($name eq 'content-disposition') { $dispose = $key }
			elsif($name eq 'content-description') { $descr   = $key }
			elsif($name eq 'content-language')    { $lang    = $key }
			elsif($name eq 'content-id')          { $cid     = $key }
			else { push @headerlines, $key }
			next;
		}

		my $value = shift // next;

lib/Mail/Message/Construct/Build.pod  view on Meta::CPAN

=item * When a keys starts with a capital, than it is always a header field

=item * When a keys is lower-cased, it is always something else

=item * You use the real field-names, not abbreviations

=item * All field names are accepted

=item * You may specify field objects between key-value pairs

=item * A lot of facts are auto-detected, like content-type and encoding

=item * You can create a multipart at once

=back

Hum, reading the list above... what is equivalent?  L<MIME::Entity> is
not that simple after all!  Let's look at an example from MIME::Entity's
manual page:

  ### Create the top-level, and set up the mail headers:

lib/Mail/Message/Field.pod  view on Meta::CPAN

  print "$field";   # via overloading

=item $obj-E<gt>B<wellformedName>( [STRING] )

(Instance method class method)
As instance method, the current field's name is correctly formatted
and returned.  When a C<STRING> is used, that one is formatted.

» example: 

  print Mail::Message::Field->Name('content-type')
    # -->  Content-Type

  my $field = $head->get('date');
  print $field->Name;
    # -->  Date

=back

=head2 The field

lib/Mail/Message/Field/Full.pm  view on Meta::CPAN


#--------------------

my %implementation;

BEGIN {
	$implementation{$_} = 'Addresses'    for qw/from to sender cc bcc reply-to envelope-to resent-from resent-to
				resent-cc resent-bcc resent-reply-to resent-sender x-beenthere errors-to mail-follow-up x-loop
				delivered-to original-sender x-original-sender/;
	$implementation{$_} = 'URIs'         for qw/list-help list-post list-subscribe list-unsubscribe list-archive list-owner/;
	$implementation{$_} = 'Structured'   for qw/content-disposition content-type content-id/;
	$implementation{$_} = 'Date'         for qw/date resent-date/;
	$implementation{$_} = 'AuthResults'  for qw/authentication-results/;
	$implementation{$_} = 'DKIM'         for qw/dkim-signature/;
#   $implementation{$_} = 'AuthRecChain' for qw/arc-authentication-results arc-message-signature arc-seal/;
}

sub new($;$$@)
{	my $class  = shift;
	my $name   = shift;
	my $body   = @_ % 2 ? shift : undef;



( run in 1.504 second using v1.01-cache-2.11-cpan-524268b4103 )