How to return mail to sender when it's in mail queue?

Discussion in 'General' started by recin, Aug 7, 2022.

Tags:
  1. recin

    recin Active Member

    I have a ISPConfig server installed with the autoinstaller running under Ubuntu 20.04 with dovecot and postfix.
    While checking mail queue I see sometimes blocked mails with Connection timed out or similar errors because of local sender misspelled a remote recipient or he's replying to a no-reply account.

    Postfix will try to deliver it for several days and, if It can't, it will send to sender an "undelivered mail return to sender" reply. That's nice, But I'm wondering if is there any way to force this "undelivered mail return to sender" reply, so when I check mail queue and there is a mail error, I can send this reply to the sender at the moment, in order not to have this mail in queue for several days.

    I know I can clear mail queue but, with this, sender won't notice the error.

    Is this possible?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Which problem do you have with having them in the mail queue? Postfix handles this automatically, it retries it several times (as any mail system should do) and then sends a nondelivery notification when it fails. You can set shorter retry times in postfix, but setting them too short or doing that immediately as you asked for will cause deliverable emails to fail e.g. when the receiver uses greylisting.

    You can e.g. use values like this in postfix main.cf to set the queue time zo 30 minutes if you don't want postfix to retry delivery for a few days:

    Code:
    maximal_queue_lifetime = 30m
    maximal_backoff_time = 10m
    minimal_backoff_time = 5m
    queue_run_delay = 5m
     
  3. recin

    recin Active Member

    I'm fine with actual config but if I see a misspelled mail in queue I don't want to have it there for several days, neither delete it without tell the sender it's wrong.
    If there is no way of do this there is no problem, I will let the mail in queue until postfix send the notice
     

Share This Page