Server IP : 85.214.239.14 / Your IP : 3.144.25.230 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /usr/share/doc/libmailtools-perl/examples/ |
Upload File : |
#!/usr/bin/perl -w require Mail::Internet; require Mail::Alias; use Getopt::Long; sub expand_aliases { my $mail = shift; my $aliasfile = $ENV{HOME} . "/.mailrc"; my($tag,$id); if( -f $aliasfile ) { my $alias = Mail::Alias::Binmail->new($aliasfile); # Expand aliases foreach $tag (qw(To Cc Bcc)) { @ids = (); foreach $id (Mail::Address->parse($mail->get($tag))) { my $addr = $id->address; my @expn = $alias->expand($addr); if(scalar(@expn) == 1) { $id->address($expn[0]); push(@ids,$id->format); } else { push(@ids,@expn); } } $mail->combine($tag,','); $mail->replace($tag, join(", ", @ids)); } } } ### ### Main program ### GetOptions(qw(post nosig v)); $opt_post = 1 if $0 =~ m#(\A|/)post\Z#; $verbose = defined $opt_v && $opt_v ? 1 : 0; $posting = defined $opt_post && $opt_post ? 1 : 0; $sign = defined $opt_nosig && $opt_nosig ? 0 : 1; $mail = Mail::Internet->new([ <> ]); expand_aliases($mail); $mail->add_signature if($sign); if($posting) { my @groups = $mail->nntppost(); if($verbose && @groups) { $groups = "Newsgroups: " . join(", ", @groups); $groups =~ s/(.{10,78}),/$1\n/g if(length($groups) > 78); print $groups,"\n"; } } else { $mail->delete('Newsgroups'); } @recp = $mail->smtpsend(); if($verbose && @recp) { $recp = "Recipients: " . join(", ", @recp); $recp =~ s/(.{10,78}),/$1\n/g if(length($recp) > 78); print $recp,"\n"; } exit;