]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - scripts/makemail
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / scripts / makemail
CommitLineData
7d2ce6f7
GKH
1#!/usr/bin/perl -w
2
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
12use strict;
13
14my $TRUE=1; my $FALSE = 0;
15
16use Getopt::Long;
17
18
19my %options;
20
21GetOptions(\%options,
22 "from=s",
23 "to=s",
24 "cc=s",
25 "subject=s",
26 "date=s",
1582f8c5 27 "reply_to:s",
8d895cd7
GKH
28 "message_id=s",
29 "charset=s"
7d2ce6f7
GKH
30 );
31
32if (defined($options{"subject"})) {
33 print("Subject: " . $options{"subject"} . "\n");
34}
35if (defined($options{"to"})) {
36 print("To: " . $options{"to"} . "\n");
37}
38if (defined($options{"cc"})) {
39 print("Cc: " . $options{"cc"} . "\n");
40}
41if (defined($options{"from"})) {
42 print("From: " . $options{"from"} . "\n");
43}
44if (defined($options{"date"})) {
45 print("Date: " . $options{"date"} . "\n");
46}
47if (defined($options{"reply_to"})) {
1582f8c5
GKH
48 if ($options{"reply_to"} ne "") {
49 print("In-Reply-To: <" . $options{"reply_to"} . ">\n");
50 }
7d2ce6f7 51}
b326741b
GKH
52if (defined($options{"message_id"})) {
53 print("Message-ID: <" . $options{"message_id"} . ">\n");
54}
8d895cd7
GKH
55if (defined($options{"charset"})) {
56 print("MIME-Version: 1.0\nContent-Type: text/plain; charset=" . $options{"charset"} . "\nContent-Transfer-Encoding: 8bit\n");
57}
7d2ce6f7
GKH
58
59print("\n");
60
61while (<STDIN>) {
62 print;
63}