]>
| Commit | Line | Data |
|---|---|---|
| 1 | #!/usr/bin/perl -w | |
| 2 | # SPDX-License-Identifier: GPL-2.0 | |
| 3 | #----------------------------------------------------------------------------- | |
| 4 | # All this does is generate RFC 822 headers and then copy standard input | |
| 5 | # to standard output. You determine what headers it generates with | |
| 6 | # command options. | |
| 7 | # | |
| 8 | # You can feed the output of this program to 'smtpsend' to send the mail | |
| 9 | # message somewhere via SMTP. | |
| 10 | #----------------------------------------------------------------------------- | |
| 11 | ||
| 12 | use strict; | |
| 13 | ||
| 14 | my $TRUE=1; my $FALSE = 0; | |
| 15 | ||
| 16 | use Getopt::Long; | |
| 17 | ||
| 18 | ||
| 19 | my %options; | |
| 20 | ||
| 21 | GetOptions(\%options, | |
| 22 | "from=s", | |
| 23 | "to=s", | |
| 24 | "cc=s", | |
| 25 | "subject=s", | |
| 26 | "date=s", | |
| 27 | "reply_to:s", | |
| 28 | "message_id=s", | |
| 29 | "charset=s", | |
| 30 | "stable=s", | |
| 31 | ); | |
| 32 | ||
| 33 | if (defined($options{"subject"})) { | |
| 34 | print("Subject: " . $options{"subject"} . "\n"); | |
| 35 | } | |
| 36 | if (defined($options{"to"})) { | |
| 37 | print("To: " . $options{"to"} . "\n"); | |
| 38 | } | |
| 39 | if (defined($options{"cc"})) { | |
| 40 | print("Cc: " . $options{"cc"} . "\n"); | |
| 41 | } | |
| 42 | if (defined($options{"from"})) { | |
| 43 | print("From: " . $options{"from"} . "\n"); | |
| 44 | } | |
| 45 | if (defined($options{"date"})) { | |
| 46 | print("Date: " . $options{"date"} . "\n"); | |
| 47 | } | |
| 48 | if (defined($options{"reply_to"})) { | |
| 49 | if ($options{"reply_to"} ne "") { | |
| 50 | print("In-Reply-To: <" . $options{"reply_to"} . ">\n"); | |
| 51 | } | |
| 52 | } | |
| 53 | if (defined($options{"message_id"})) { | |
| 54 | print("Message-ID: <" . $options{"message_id"} . ">\n"); | |
| 55 | } | |
| 56 | if (defined($options{"charset"})) { | |
| 57 | print("MIME-Version: 1.0\nContent-Type: text/plain; charset=" . $options{"charset"} . "\nContent-Transfer-Encoding: 8bit\n"); | |
| 58 | } | |
| 59 | ||
| 60 | if (defined($options{"stable"})) { | |
| 61 | print("X-stable: " . $options{"stable"} . "\n"); | |
| 62 | print("X-Patchwork-Hint: ignore \n"); | |
| 63 | } | |
| 64 | ||
| 65 | print("\n"); | |
| 66 | ||
| 67 | while (<STDIN>) { | |
| 68 | print; | |
| 69 | } |