[Question] I'd like to alter Message-ID when releasing from quarantine

Eoin Kim Eoin.Kim at rcst.com.au
Fri Jul 20 23:24:46 UTC 2018

Hi Shawn,

Thanks for your response. I was thinking about it for a while but then I have to think about the source and destination in the rule. I think I have to use FromAndTo: but I am not sure with the syntax. I guess From should be my gateway (e.g. and To should be the IP address of the Exchange server, is it? But can I actually put these two addresses on the same line in the rule file? I always used From: or To: separately, never used FromAndTo:, hence, I may need a bit of help with the syntax. Plus, what I am acutally worrying about is when I use a rule file, if this operation happening when releasing from quarantine only because I think every email is relayed from the gateway (Ah.... I wish I could speak in English better).

I also was thinking about a different approach, touching the following file - MailWatch/mailscanner/functions.php. More specifically, the line below:

$cmd = QUARANTINE_SENDMAIL_PATH . ' -i -f ' . MAILWATCH_FROM_ADDR . ' ' . escapeshellarg(stripslashes($to)) . ' < ';

Say, if I could execute sed operation (I actually got help, thanks Schlake) beforehand, that would be alright to me. For example, like this:

1. Run sed -i -e "/^H??Message-ID: /s/\(Message-ID: .*\)@\(.*\)/\1-$$@\2/" <
2. After that run $cmd

I am not really confident with PHP, well.... actually any languages :( but I think touching functions.php file more makes sense to me because I believe this will only affect when releasing messages from quarantine, which I want. I don't want to put changing Message-ID operation in any other situations since RFC document recommends not to touch it.

What do you think about this Shawn? Thanks again for your help.

From: MailScanner <mailscanner-bounces+eoin.kim=rcst.com.au at lists.mailscanner.info> on behalf of Shawn Iverson <iversons at rushville.k12.in.us>
Sent: Friday, 20 July 2018 6:17 PM
To: MailScanner Discussion
Subject: Re: [Question] I'd like to alter Message-ID when releasing from quarantine


Can you create a ruleset for header removal in MailScanner (I'm not sure removing the Message-ID is a good idea, but you could give it a try)?

On Fri, Jul 20, 2018 at 12:52 AM, Eoin Kim <Eoin.Kim at rcst.com.au<mailto:Eoin.Kim at rcst.com.au>> wrote:
Hi all,

I am trying to configure MailScanner with MailWatch on Debian 9. Sorry, I didn't want to involve MailWatch here but since I am trying to use a function from it, I included the name here. As the MTA, I installed Postfix. What I want to achieve is releasing mails from quarantine via sendmail not by a file (this is the feature from MailWatch). However, I am having a problem with this.

There is a Microsoft Exchange server sitting behind this Debian host and it rejects the released email because of the duplicate Message-ID. My senior person doesn't want to enable the feature of ignoring duplicate on Exchange server. I know there is a feature in MailScanner which removes Message-ID from the mail header. However, I don't want to remove this from every single message. Are there any ways to alter Messag-ID only when the message is released from quarantine?

I know that if I release emails as a file, no worries. However, I don't want to do so as there are a huge amount of users who don't use MUA. I would really appreciate if I can get any helps. Thanks a lot.

Eoin Kim
Systems Administrator

RCS Telecommunications
Level 1 - The Annexe, 133 Mary Street
Brisbane, QLD, 4000, Australia
Office: 07 3228 0843
Mobile: 0419 726 231
Email: eoin.kim at rcst.com.au<mailto:eoin.kim at rcst.com.au>

MailScanner mailing list
mailscanner at lists.mailscanner.info<mailto:mailscanner at lists.mailscanner.info>

Shawn Iverson, CETL
Director of Technology
Rush County Schools
765-932-3901 x1171
iversons at rushville.k12.in.us<mailto:iversons at rushville.k12.in.us>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mailscanner.info/pipermail/mailscanner/attachments/20180720/beee70bb/attachment.html>

More information about the MailScanner mailing list