Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoreply only for direct message and not alias #49

Open
twagener opened this issue Sep 27, 2017 · 1 comment
Open

Autoreply only for direct message and not alias #49

twagener opened this issue Sep 27, 2017 · 1 comment

Comments

@twagener
Copy link

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

@twagener
Copy link
Author

twagener commented 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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant