1 #!/usr/local/bin/perl -w
9 smtp.self - mail a message via smtp
13 C<smtp.self> will attempt to send a message to a given user
21 Enabe the output of dubug information
25 Display this help text and quit
29 Send the message to C<USERNAME>
33 demos/smtp.self -user foo.bar
35 demos/smtp.self -debug -user Graham.Barr
44 GetOptions(qw(debug user=s help));
49 Net::SMTP->debug(1) if $opt_debug;
51 $smtp = Net::SMTP->new("mailhost");
53 $user = $opt_user || $ENV{USER} || $ENV{LOGNAME};
55 $smtp->mail($user) && $smtp->to($user);
58 if($smtp->mail($user) && $smtp->to($user))
62 map { s/-USER-/$user/g } @data=<DATA>;
64 $smtp->datasend(@data);
76 Subject: A test message
78 The message was sent directly via SMTP using Net::SMTP
80 The message was sent directly via SMTP using Net::SMTP