MIME::Lite 3.030 - NET::SMTP with smtps (port 465)

前端 未结 1 395
慢半拍i
慢半拍i 2020-12-04 04:06

MIME::Lite can pass extra parameters to Net::SMTP constructor.
Version MIME::Lite 3.030 does not include SSL on its l

相关标签:
1条回答
  • 2020-12-04 04:31

    One thing you could do is wrapping __opts with some function that modifies the parameters are passed to it.

    In line 2876:

    my %opts = __opts(\%args, @_net_smtp_opts);
    

    The advantage here is that after the reference to %args, the rest of parameters is always the array @net_smtp_opts defined earlier. Unfortunately you can't modify its value at distance (it's a lexical variable), but you can do something like this:

    use strict;
    use warnings;
    
    use MIME::Lite;
    use Class::Method::Modifiers;
    
    around 'MIME::Lite::__opts' => sub {
      my $orig = shift;
      push(@_,'SSL') if @_ >= 2 && $_[1] eq 'Hello';
      my (@ret) = $orig->(@_);
      return @ret;
    };
    

    This way every call to MIME::Lite::__opts is "intercepted", and you have the ability to modify the parameters at your will.

    0 讨论(0)
提交回复
热议问题