A message for Linux.com registered users: We are in the process of making changes to the Linux forums. Starting Monday, 8/13/18 at 6:00 PM PT, you will be unable to access the forums. They will re-launch as soon as possible on Wednesday, 8/15/18 with new features and improved functionality. Thank you for your patience and stay tuned for the new improved forums.

January 18, 2011

Sendmail scripting - amending subjects of emails


I am using a .pl script with sendmail to complete the task: Copy inbound mail to disk for parsing into DB system before forwarding onto a different recipient address...


use strict;
use warnings;

open(OUTFILE, ">/maildump/" . $ARGV[0] . "/message" . "$$" . "$^T" . int(rand(100)) . ".eml");

while (<STDIN>) {
print OUTFILE;


What I would like to do is to amend the subject lines for emails being delivered into Sendmail from external sources/mail servers.

For the amended subjects I want to prefix them with "LM:".. example... Original Subject = Hello World, New subject = LM: Hello World.

Anyone have any ideas?

Click Here!