1

Topic: Group email modify From or prepend subject

Hello,

I have a setup using Active directory and iRedMail and everything is working as expected, except for group emails.

I have it all seutp and the emails are being delivered, but the header isn't as I need.

For example:   I have group1 with user1, user2, and user3.
I also have group2, with user1 and user2.

if user1 sends an email to group1 and group2, he should get 2 copies of the message, which is working fine  after I changed /etc/postfix/main.cf to "enable_original_recipient = no"

BUT, each of the messages is identical.  I'd like to have something in the message to distinguish where it came from, such as changing the From: to group1@domain.com or prepending the subject with something like GROUP1:

I could be going down the wrong path all together, but this is what I have tried so far:

header_checks:   as far as I can tell, these can only search for a substring and change that same substring.  I'd need it to search for a To: and change the From:, which I dont think it can do

custom transport:
I changed my transport to:
mycomain.com groupscript

I added groupscript to master.cf
groupscript unix -    n    n    -    50    pipe flags=DRhuO user=vmail argv=/var/spool/filter/groupfilter ${sender} ${user}@${domain}

and I have the file /var/spool/filter/groupfilter with the following contents:

#!/bin/bash
cat > /var/spool/filter/$1_$$_$2
{tons of attempts to read the to}
cat /var/spool/filter/$1_$$_$2 | /usr/lib/dovecot/deliver -f $1 -d $2

But my problem with this is if the sender puts two groups in the To filed, and doesn't use cc or bcc, it has to pick one.  Since this results in two executions of the script how can it know that one would need to go down the group1 path, and the other needs to go down the group2 path?

I know when looking at the /etc/var/mail.log file, I see orig_to with the proper address, but I cannot get this to pass to my script.  I went through a process I found on this forum to get ${original_recipient} to work in the master.cf file, and it started working but is still passing the user's email address, not the orig_to (ie group1@domain.com)

At this point, i'm still working on the script, but I feel like i'm over complicating this.  Is there a more direct way of handling  this?


==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.6 OPENLDAP edition.
- Linux/BSD distribution name and version: Ubuntu 16.04.2 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP (Active Directory)
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Thank you very much
mrusogi

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Group email modify From or prepend subject

We need a mailing list management software for this purpose: mailman, mlmmj, Sympa, etc.