The Perl Advent Calendar needs more articles for 2022. Submit your idea today!
The bin directory contains some demos to show the use of the Mail library

To make these demos first type

 perl Makefile.PL
 make

replyto_demo/forwd_demo/send_demo

these demos will not be installed by make install and will directly
reference the source directory.

With a few small modifications these scripts can be made to use the
installed files and can be of general use. In fact these are very close
copies of the scripts I use to send/forward/reply to mail.

Each of the scripts except an Internet message as input.

forwd_demo & rplyto_demo both read ~/.mailhdr as an empty header template
for the new mail. Mine looks like

--%<----%<----%<----%<----%<----%<----%<--
To:
Cc:
Bcc: [my email address]
Newsgroups:
In-Reply-To:
References:
Reply-To: [my email address]
From: [my email address]
Subject:
--%<----%<----%<----%<----%<----%<----%<--

Any addresses that are included on the Bcc line above will be excluded from
appearing on either the To or Cc lines.

forwd_demo:

   This creates a file under /tmp which contains an Internet message
   with empty headers and the input message included in the body.

rplyto_demo:

   This creates a file under /tmp which contains an Internet message
   with headers filled in to send the message to all people who originally
   received the message and the input message quoted in the body.

send_demo:

   This takes an Internet message as input and uses sendmail to send
   the message.  It also allows the user to defined aliases in their
   ~/.mailrc file in the same format as would be expected by binmail

       alias name expansion

   If you have News::NNTPClient installed then this script can also be
   used to post to a newsgroup by adding a Newsgroups: line into the
   header and passing a -post option on the cmdline.