| Server IP : 85.214.239.14 / Your IP : 216.73.216.178 Web Server : Apache/2.4.65 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/cwd/usr/share/doc/libmime-tools-perl/examples/ |
Upload File : |
#!/usr/bin/perl
=head1 NAME
mimesender - an example of integrating MIME-tools with Mail::Send.
=head1 SYNOPSIS
Usage:
mimesender YOU@YOUR.HOST
=head1 DESCRIPTION
This just fakes up a little message and sends it by using Mail::Send
and the 'sendmail' handler.
=head1 AUTHOR
Eryq, eryq@zeegee.com.
=cut
use Mail::Send;
use MIME::Entity 4.113;
use File::Spec;
### Args?
my ($to) = @ARGV;
$to or die "Usage: mimesender toaddr\n";
### Create MIME entity, with attachment, sent to us:
my $ent = MIME::Entity->build(From => "secret\@admirer.net",
To => $to,
Subject => 'Hello there!',
Data => "Saluations...");
$ent->attach(Type => 'text/plain',
Data => "...and Felicitations!");
### Send it:
$sender = new Mail::Send;
foreach ($ent->head->tags) { # give the sender our headers
$sender->set($_, map {chomp $_; $_} $ent->head->get($_));
}
$fh = $sender->open('sendmail');
$ent->print_body($fh);
$fh->close;