| #!/usr/bin/perl -w |
| |
| #----------------------------------------------------------------------------- |
| # All this does is generate RFC 822 headers and then copy standard input |
| # to standard output. You determine what headers it generates with |
| # command options. |
| # |
| # You can feed the output of this program to 'smtpsend' to send the mail |
| # message somewhere via SMTP. |
| #----------------------------------------------------------------------------- |
| |
| use strict; |
| |
| my $TRUE=1; my $FALSE = 0; |
| |
| use Getopt::Long; |
| |
| |
| my %options; |
| |
| GetOptions(\%options, |
| "from=s", |
| "to=s", |
| "cc=s", |
| "subject=s", |
| "date=s", |
| "reply_to=s", |
| "message_id=s", |
| "charset=s" |
| ); |
| |
| if (defined($options{"subject"})) { |
| print("Subject: " . $options{"subject"} . "\n"); |
| } |
| if (defined($options{"to"})) { |
| print("To: " . $options{"to"} . "\n"); |
| } |
| if (defined($options{"cc"})) { |
| print("Cc: " . $options{"cc"} . "\n"); |
| } |
| if (defined($options{"from"})) { |
| print("From: " . $options{"from"} . "\n"); |
| } |
| if (defined($options{"date"})) { |
| print("Date: " . $options{"date"} . "\n"); |
| } |
| if (defined($options{"reply_to"})) { |
| print("In-Reply-To: <" . $options{"reply_to"} . ">\n"); |
| } |
| if (defined($options{"message_id"})) { |
| print("Message-ID: <" . $options{"message_id"} . ">\n"); |
| } |
| if (defined($options{"charset"})) { |
| print("MIME-Version: 1.0\nContent-Type: text/plain; charset=" . $options{"charset"} . "\nContent-Transfer-Encoding: 8bit\n"); |
| } |
| |
| print("\n"); |
| |
| while (<STDIN>) { |
| print; |
| } |