[GH-ISSUE #49] Autoreply only for direct message and not alias #27

Open
opened 2026-02-27 10:25:23 +03:00 by kerem · 1 comment
Owner

Originally created by @twagener on GitHub (Sep 27, 2017).
Original GitHub issue: https://github.com/modoboa/modoboa-postfix-autoreply/issues/49

It would be great to check if the original mail goes to a alias-list or is only for me. So auto reply won't answer for a mail which was not only for me and was sent to an alias

Originally created by @twagener on GitHub (Sep 27, 2017). Original GitHub issue: https://github.com/modoboa/modoboa-postfix-autoreply/issues/49 It would be great to check if the original mail goes to a alias-list or is only for me. So auto reply won't answer for a mail which was not only for me and was sent to an alias
Author
Owner

@twagener commented on GitHub (Oct 2, 2017):

i made it working for me... if anyone needs this - change it like this:

i added the original_recipient option in
env/lib/python2.7/site-packages/modoboa_postfix_autoreply/management/commands

`def add_arguments(self, parser):
"""Add extra arguments to command line."""
parser.add_argument(
"--debug", action="store_true", dest="debug", default=True
)
parser.add_argument("sender", type=unicode)
parser.add_argument("recipient", type=unicode, nargs="+")
parser.add_argument("original_recipient", type=unicode)

def handle(self, *args, **options):
    if options["debug"]:
        logger.setLevel(logging.DEBUG)

    logger.debug(
        "autoreply sender=%s recipient=%s orig=%s",
        options["sender"], ",".join(options["recipient"]), options["original_recipient"]
    )

    original_recipient = options["original_recipient"]
    recipient = options["recipient"]

    if ( original_recipient not in recipient ):
        logger.debug(
            "Skip auto reply, this mail was for an alias list")
        return`

and modified the master.cf from postfix like this:
autoreply unix - n n - - pipe flags= user=vmail:vmail argv=/srv/modoboa/env/bin/python /srv/modoboa/instance/manage.py autoreply $sender $mailbox $original_recipient

<!-- gh-comment-id:333540713 --> @twagener commented on GitHub (Oct 2, 2017): i made it working for me... if anyone needs this - change it like this: i added the original_recipient option in env/lib/python2.7/site-packages/modoboa_postfix_autoreply/management/commands `def add_arguments(self, parser): """Add extra arguments to command line.""" parser.add_argument( "--debug", action="store_true", dest="debug", default=True ) parser.add_argument("sender", type=unicode) parser.add_argument("recipient", type=unicode, nargs="+") parser.add_argument("original_recipient", type=unicode) def handle(self, *args, **options): if options["debug"]: logger.setLevel(logging.DEBUG) logger.debug( "autoreply sender=%s recipient=%s orig=%s", options["sender"], ",".join(options["recipient"]), options["original_recipient"] ) original_recipient = options["original_recipient"] recipient = options["recipient"] if ( original_recipient not in recipient ): logger.debug( "Skip auto reply, this mail was for an alias list") return` and modified the master.cf from postfix like this: `autoreply unix - n n - - pipe flags= user=vmail:vmail argv=/srv/modoboa/env/bin/python /srv/modoboa/instance/manage.py autoreply $sender $mailbox $original_recipient `
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-postfix-autoreply-modoboa#27
No description provided.