On Tue, Mar 22, 2005 at 12:49:07PM +0800, Rafael 'Dido' Sevilla wrote:
> Look into this little program:
> 
> http://packages.debian.org/stable/mail/ssmtp.html

or try perl. :-) I use the following on the machines I admin:

# --- BEGIN send-email1
#!/usr/bin/perl -w
# send-email - simple mail(1) substitute using Mail::Mailer
# Sherwin Daganato <win[AT]email[DOT]com[DOT]ph>, 20020716
# usage: echo body | ./send-email -s subject [EMAIL PROTECTED]

use strict;
use Mail::Mailer;
use Getopt::Std;

our($opt_s);
Getopt::Std::getopt('s');

my %hash;
my $server     = 'smtp.example.com';
$hash{To}      = [EMAIL PROTECTED];
$hash{Subject} = $opt_s if ( $opt_s );

my $mailer = new Mail::Mailer 'smtp', Server => $server;
$mailer->open({ %hash }) or die "Can't open: $!\n";
print $mailer <STDIN>;
$mailer->close;
exit 0;
# --- END send-email1

# --- BEGIN send-email2
#!/usr/bin/perl -w
# send-email - simple mail(1) substitute using Net::SMTP
# Sherwin Daganato <win[AT]email[DOT]com[DOT]ph>, Sep 17 2002
# usage: echo body | ./send-email -s subject [EMAIL PROTECTED]

use strict;
use Net::SMTP;
use Getopt::Std;
use Sys::Hostname;

our($opt_s);
Getopt::Std::getopt('s');

my $server = 'smtp.example.com';
my $mailaddress = sprintf('[EMAIL PROTECTED]', scalar getpwuid($<), hostname);
my $smtp = Net::SMTP->new($server);
$smtp->mail($mailaddress);
foreach (@ARGV) {
  $smtp->to($_);
}
$smtp->data;
$smtp->datasend("From: <$mailaddress>\n");
$smtp->datasend("Subject: $opt_s\n") if ($opt_s);
{ 
  local $" = ',';
  $smtp->datasend("To: @ARGV\n");
}
$smtp->datasend("\n"); # terminate headers
while (<STDIN>) {
  $smtp->datasend($_);
}
$smtp->dataend;
$smtp->quit;
exit 0;
# --- END send-email2


-- 
$_=q:; # SHERWIN #
70;72;69;6e;74;20;
27;4a;75;73;74;20;
61;6e;6f;74;68;65;
72;20;50;65;72;6c;
20;6e;6f;76;69;63;
65;27;:;;s=~?(..);
?=pack q$C$,hex$1;
;;;=egg;;;;eval;;;
--
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph)
Official Website: http://plug.linux.org.ph
Searchable Archives: http://marc.free.net.ph
.
To leave, go to http://lists.q-linux.com/mailman/listinfo/plug
.
Are you a Linux newbie? To join the newbie list, go to
http://lists.q-linux.com/mailman/listinfo/ph-linux-newbie

Reply via email to