On Saturday 28 May 2016 22:33:02 Ricardo Signes wrote:
> > Thanks to named group support I would like to extend Email::MIME
> > module to allow passing directly Email::Address::XS objects, not
> > only string headers to make MIME encoding and decoding from
> > applications easier.
> > 
> > What do you think about it?
> 
> I'm not sure what you're suggesting.  Do you mean:
> 
>   Email::MIME->create(..., header => [ To => $addr_xs, ...  ]);
> 
> ...as opposed to:
> 
>   Email::MIME->create(..., header => [ To => $addr_xs->as_string, ...
>  ]);
> 
> ?  Could you elaborate?

Basically yes. From caller perspective I want to pass email address 
object and let Email::MIME to do MIME encoding correctly. Something like 
this:

my $email = Email::MIME->create(
        header_addr => [
                From => Email::Address::XS->new(Name => 'user@host'),
                To => [
                        Email::Address::XS->new(Name2 => 'user2@host'),
                        Email::Address::XS->new(Name3 => 'user3@host'),
                ],
        ],
);

Currently Email::MIME module takes UTF-8 formatted To (or Cc) header, 
construct from it Email::Address object, then MIME encode phrase part 
and after that format header back to string line.

If I pass Email::Address::XS object directly to Email::MIME, then one 
step of decomposition (from ->as_string back to Email::Address object) 
will not be needed.

Also in same way I would to pass named group of email addresses, e.g:

my $email = Email::MIME->create(
        header_grps => [
                To => [
                        $group_name => [ $address1_obj, $address2_obj ],
                ],
        ],
);

Currently Email::MIME from all named groups, because it uses 
Email::Address parser and it does not support it.

My Email::Address::XS supports also named groups of addresses, so above 
syntax can be implemented via Email::Address::XS module.

Reply via email to