App-CLI-Plugin-Net-SMTP

 view release on metacpan or  search on metacpan

inc/Module/Install/Fetch.pm  view on Meta::CPAN


    require Cwd;
    my $dir = Cwd::getcwd();
    chdir $args{local_dir} or return if exists $args{local_dir};

    if (eval { require LWP::Simple; 1 }) {
        LWP::Simple::mirror($args{url}, $file);
    }
    elsif (eval { require Net::FTP; 1 }) { eval {
        # use Net::FTP to get past firewall
        my $ftp = Net::FTP->new($host, Passive => 1, Timeout => 600);
        $ftp->login("anonymous", 'anonymous@example.com');
        $ftp->cwd($path);
        $ftp->binary;
        $ftp->get($file) or (warn("$!\n"), return);
        $ftp->quit;
    } }
    elsif (my $ftp = $self->can_run('ftp')) { eval {
        # no Net::FTP, fallback to ftp.exe
        require FileHandle;
        my $fh = FileHandle->new;

lib/App/CLI/Plugin/Net/SMTP.pm  view on Meta::CPAN

=head1 SYNOPSIS

  # MyApp.pm
  package MyApp;
  
  use strict;
  use base qw(App::CLI::Extension);
  
  # extension method
  __PACKAGE__->load_plugins(qw(Net::SMTP));
  __PACKAGE__->config(net_smtp => { Host => "localhost", Port => 25, Timeout => 30 });
  
  1;
  
  # MyApp/Mailer.pm
  package MyApp::Hello;
  use strict;
  use feature ":5.10.0";
  use base qw(App::CLI::Command);
  use Encode qw(encode decode);
  use MIME::Entity;

lib/App/CLI/Plugin/Net/SMTP.pm  view on Meta::CPAN


  # if your shell is bash...
  export APPCLI_SMTP_STARTTLS=1

Example2 StartTLS config:

  # in MyApp.pm
  __PACKAGE__->config(
                net_smtp => {
                        Host     => "localhost",
                        Timeout  => 30,
                        Port     => 465,
                        StartTLS => 1
                      }
              );

Example3 starttls option:

  echo "hello" | ./myapp mailer -f "me@localhost" -t "you@remotehost" -s "mail subject" --starttls

Advance



( run in 0.245 second using v1.01-cache-2.11-cpan-a5abf4f5562 )