Forward email in Custom Rues

Discussion in 'General' started by Gray Consulting, Mar 21, 2018.

  1. Gray Consulting

    Gray Consulting New Member

    I am having a problem forwarding emails using custom rules.
    ISPconfig 3 - Amazon EC2 server using dovecot and roundcube.
    I want to forward the email and keep it in the original email inbox.

    I followed the steps detailed here, https://www.faqforge.com/linux/cont...-copys-of-incoming-emails-to-other-mailboxes/, for sieve with both single quotes and double quotes but while the email lands in the sent to mailbox it does not get forwarded on to the addresses in the custom rule.

    Custom rule has the following:
    redirect [email protected]';
    keep;

    I am sending to an email in the same domain but have also tried to redirect to a domain not on the same server but no luck.

    Thanks.

    Here is a section of the mail.log

    Mar 21 14:43:02 ip-172-31-25-207 postfix/smtpd[25045]: connect from localhost[127.0.0.1]
    Mar 21 14:43:02 ip-172-31-25-207 dovecot: auth: Debug: auth client connected (pid=0)
    Mar 21 14:43:02 ip-172-31-25-207 postfix/smtpd[25045]: 1ABC64201A: client=localhost[127.0.0.1]
    Mar 21 14:43:02 ip-172-31-25-207 postfix/cleanup[25029]: 1ABC64201A: message-id=<CALN4Np9mCpbFaLp6fQ=[email protected]>
    Mar 21 14:43:02 ip-172-31-25-207 postfix/qmgr[1841]: 1ABC64201A: from=<[email protected]>, size=4139, nrcpt=1 (queue active)
    Mar 21 14:43:02 ip-172-31-25-207 postfix/smtpd[25045]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
    Mar 21 14:43:02 ip-172-31-25-207 amavis[29669]: (29669-10) Passed CLEAN {RelayedInbound}, [209.85.161.172]:43418 [209.85.161.172] <[email protected]>-> <[email protected]>, Queue-ID: 1E1EF3F236, Message-ID: <CALN4Np9mCpbFaLp6fQ=[email protected]>, mail_id: LfvfHhuWlf03, Hits: -0.018, size: 3482, queued_as: 1ABC64201A, dkim_sd=20150623:eek:utsidedomain-com.20150623.gappssmtp.com, 850 ms
    Mar 21 14:43:02 ip-172-31-25-207 postfix/smtp[25030]: 1E1EF3F236: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=1.1, delays=0.27/0.01/0/0.85, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 1ABC64201A)
    Mar 21 14:43:02 ip-172-31-25-207 postfix/qmgr[1841]: 1E1EF3F236: removed
    Mar 21 14:43:02 ip-172-31-25-207 dovecot: auth: Debug: master in: USER#0111#[email protected]#011service=lda
    Mar 21 14:43:02 ip-172-31-25-207 dovecot: auth: Debug: prefetch([email protected]): passdb didn't return userdb entries, trying the next userdb
    Mar 21 14:43:02 ip-172-31-25-207 dovecot: auth-worker(24711): Debug: sql([email protected]): SELECT email as user, maildir as home, CONCAT( maildir_format, ':', maildir, '/', IF(maildir_format='maildir','Maildir',maildir_format)) as mail, uid, gid, CONCAT('*:storage=', quota, 'B') AS quota_rule, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE (login = '[email protected]' OR email = '[email protected]') AND `disablelda` = 'n' AND server_id = '1'
    Mar 21 14:43:02 ip-172-31-25-207 dovecot: auth: Debug: userdb out: USER#0111#[email protected]#011home=/var/vmail/address.com/themurphys#011mail=maildir:/var/vmail/address.com/usertobeforwarded/Maildir#011uid=5000#011gid=5000#011quota_rule=*:storage=0B#011sieve=/var/vmail/address.com/usertobeforwarded/.sieve
    Mar 21 14:43:02 ip-172-31-25-207 dovecot: lda([email protected]): msgid=<CALN4Np9mCpbFaLp6fQ=[email protected]>: saved mail to INBOX
    Mar 21 14:43:02 ip-172-31-25-207 postfix/pipe[25047]: 1ABC64201A: to=<[email protected]>, relay=dovecot, delay=0.06, delays=0.01/0.01/0/0.04, dsn=2.0.0, status=sent (delivered via dovecot service)
    Mar 21 14:43:02 ip-172-31-25-207 postfix/qmgr[1841]: 1ABC64201A: removed
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The single quote at the beginning of the email address is missing.
     
  3. Gray Consulting

    Gray Consulting New Member

    Sorry it is actually there in the rules I must have stepped on it when scrubbing the actual address,

    redirect '[email protected]';

    keep;
     
  4. Gray Consulting

    Gray Consulting New Member

    Any other thoughts on why this would not work?
     
  5. Jesse Norell

    Jesse Norell Well-Known Member

    Check /var/vmail/domain/user/.sieve.log for errors/clues. Maybe post the contents of the .sieve file in that same directory.
     
  6. Gray Consulting

    Gray Consulting New Member

    Thanks for the suggestion.
    I do not see a log file, /var/vmail/domain/user/ only contains ispconfig.sieve. Is it possible sieve is not being triggered?
    The query within the logs already submitted seem to indicate same.
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    pleasepost the output of:

    cat /var/vmail/domain/user/.sieve
     
  8. Gray Consulting

    Gray Consulting New Member

    Here you go. Thanks

    require ["fileinto", "regex", "date", "relational", "vacation"];
    redirect '[email protected]';
    keep;
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    So the forward address is in the file as it should be and your debug output shows that dovecot is aware of the sieve file sieve=/var/vmail/address.com/usertobeforwarded/.sieve, so the forwarding should happen.
     
  10. Gray Consulting

    Gray Consulting New Member

    Earlier on it was suggested to check the .sieve.log for errors/clues.
    Is the fact that this log does not exist an indication that the forwarding is not happening?
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    Not really, as far as I know, this log gets created only when an error occurs, so no such log is a good sign.
     
  12. Gray Consulting

    Gray Consulting New Member

    So if the configuration is correct and the lack of a log file suggests no errors, any ideas on next steps to work out why the emails do not appear to be redirected?
     
  13. Jesse Norell

    Jesse Norell Well-Known Member

  14. Gray Consulting

    Gray Consulting New Member


    Thanks Jesse -
    We're still coming up empty here. Tried that link to turn on trace logging, to no avail. There is no file ".sieve.svbin"; the only file in the usertobeforwarded dir is .sieve, which is a link to usertobeforwarded/sieve/ispconfig.sieve

    Everything we're looking at seems to imply that the .sieve file considered (it is cited in the logs when expected), but no action is ever taken. syslog and mail.log show no entries relating to any send after the sieve (the forward), nor do they show any related errors. There are no sieve logs being created. Permissions are wide open (for the moment), 0755/vmail:vmail.

    Are there any general settings that would cause any sieve directives to be ignored? Any suggestions you can offer sure would be appreciated.

    Cheers ~
     
  15. Jesse Norell

    Jesse Norell Well-Known Member

    `grep mail_plugins /etc/dovecot/dovecot.conf` .. do you have sieve listed in mail_plugins?
     
  16. Gray Consulting

    Gray Consulting New Member

    Thanks for this. It was commented out.
    All working now.
    I appreciate the help.
     

Share This Page