Can't get Sieve to work

Emails aren't being sorted. Here are my (sanitized) logs (Note, the source email is from an account on the same server):

Mar  2 04:13:53 hostname postfix/smtpd[3782]: connect from c-XX-XX-XXX-XX.hsd1.ma.comcast.net[XX.XX.XXX.XX]
Mar  2 04:13:53 hostname postfix/smtpd[3782]: warning: connect to Milter service local:/opendkim/opendkim.sock: No such file or directory
Mar  2 04:13:53 hostname dovecot: auth-worker(3786): mysql(127.0.0.1): Connected to database mailserver
Mar  2 04:13:53 hostname postfix/smtpd[3782]: 97B3040DF8: client=c-XX-XX-XXX-XX.hsd1.ma.comcast.net[XX.XX.XXX.XX], sasl_method=PLAIN, sasl_username=emailsender@senderdomain.com
Mar  2 04:13:53 hostname postfix/cleanup[3797]: 97B3040DF8: message-id=<869fdd43-5e15-5df6-5af4-d51d4fd14cc9@senderdomain.com>
Mar  2 04:13:53 hostname postfix/qmgr[3454]: 97B3040DF8: from=<emailsender@senderdomain.com>, size=933, nrcpt=1 (queue active)
Mar  2 04:13:53 hostname dovecot: lmtp(3802): Debug: none: root=, index=, control=, inbox=, alt=
Mar  2 04:13:53 hostname dovecot: lmtp(3802): Connect from local
Mar  2 04:13:53 hostname dovecot: lmtp(3802): Debug: Loading modules from directory: /usr/lib/dovecot/modules
Mar  2 04:13:53 hostname dovecot: lmtp(3802): Debug: Module loaded: /usr/lib/dovecot/modules/lib90_sieve_plugin.so
Mar  2 04:13:53 hostname dovecot: lmtp(3802): Debug: auth input: user@example.com uid=5000 gid=5000 home=/var/mail/vhosts/example.com/user
Mar  2 04:13:53 hostname dovecot: lmtp(3802, user@example.com): Debug: Effective uid=5000, gid=5000, home=/var/mail/vhosts/example.com/user
Mar  2 04:13:53 hostname dovecot: lmtp(3802, user@example.com): Debug: Namespace inbox: type=private, prefix=, sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/var/mail/vhosts/example.com/user
Mar  2 04:13:53 hostname dovecot: lmtp(3802, user@example.com): Debug: maildir++: root=/var/mail/vhosts/example.com/user, index=, control=, inbox=/var/mail/vhosts/example.com/user, alt=
Mar  2 04:13:53 hostname dovecot: lmtp(3802, user@example.com): Debug: Tpi8J1Hit1jaDgAAT9TWUQ: sieve: using the following location for user's Sieve script: /var/mail/vhosts/example.com/user/.dovecot.sieve
Mar  2 04:13:53 hostname dovecot: lmtp(3802, user@example.com): Debug: Tpi8J1Hit1jaDgAAT9TWUQ: sieve: opening script /var/mail/vhosts/example.com/user/.dovecot.sieve
Mar  2 04:13:53 hostname dovecot: lmtp(3802, user@example.com): Debug: Tpi8J1Hit1jaDgAAT9TWUQ: sieve: script binary /var/mail/vhosts/example.com/user/.dovecot.svbin successfully loaded
Mar  2 04:13:53 hostname dovecot: lmtp(3802, user@example.com): Debug: Tpi8J1Hit1jaDgAAT9TWUQ: sieve: binary save: not saving binary /var/mail/vhosts/example.com/user/.dovecot.svbin, because it is already stored
Mar  2 04:13:53 hostname dovecot: lmtp(3802, user@example.com): Debug: Tpi8J1Hit1jaDgAAT9TWUQ: sieve: executing script from /var/mail/vhosts/example.com/user/.dovecot.svbin
Mar  2 04:13:53 hostname dovecot: lmtp(3802, user@example.com): Tpi8J1Hit1jaDgAAT9TWUQ: sieve: msgid=<869fdd43-5e15-5df6-5af4-d51d4fd14cc9@senderdomain.com>: stored mail into mailbox 'INBOX'
Mar  2 04:13:53 hostname postfix/lmtp[3801]: 97B3040DF8: to=<user@example.com>, relay=mail.domain.com[private/dovecot-lmtp], delay=0.08, delays=0.06/0.01/0/0.01, dsn=2.0.0, status=sent (250 2.0.0 <user@example.com> Tpi8J1Hit1jaDgAAT9TWUQ Saved)
Mar  2 04:13:53 hostname dovecot: lmtp(3802): Disconnect from local: Client quit (in reset)
Mar  2 04:13:53 hostname postfix/qmgr[3454]: 97B3040DF8: removed
Mar  2 04:13:53 hostname postfix/smtpd[3782]: disconnect from c-XX-XX-XXX-XX.hsd1.ma.comcast.net[XX.XX.XXX.XX]</user@example.com></user@example.com></emailsender@senderdomain.com>

This is my Sieve filter (/var/mail/vhosts/example.com/user/.dovecot.sieve):

# Sieve filter
require ["fileinto", "copy", "vacation", "envelope"];

if address :is ["From"] "emailsender@senderdomain" {
     fileinto "Sorted";
}

else(
keep;
}

It started out as a different filter built by Afterlogic Webmail, but I simplified it during troubleshooting:

# Sieve filter
require ["fileinto", "copy", "vacation"] ;

#begin = filters =
#sieve filter

#sieve_filter:1;0;0;emailsender@senderdomain.com;3;INBOX.Sorted
if header :contains ["From"] "emailsender@senderdomain.com" {
fileinto "INBOX.Sorted" ;
#stop ;
}

#end sieve filter

#end = filters =
keep ;

Finally, the only error I'm seeing (in .dovecot.sieve.log for the destination account):

sieve: info: started log at Mar 02 04:21:56.
main script: line 1: warning: no newline (CRLF) at end of hash comment at end of file.
sieve: info: started log at Mar 02 04:34:17.
main script: line 1: warning: no newline (CRLF) at end of hash comment at end of file.
sieve: info: started log at Mar 02 04:45:01.
main script: line 1: warning: no newline (CRLF) at end of hash comment at end of file.
sieve: info: started log at Mar 02 04:45:58.
main script: line 1: warning: no newline (CRLF) at end of hash comment at end of file.
sieve: info: started log at Mar 02 04:48:43.
main script: line 1: warning: no newline (CRLF) at end of hash comment at end of file.
sieve: info: started log at Mar 02 04:50:03.
main script: line 1: warning: no newline (CRLF) at end of hash comment at end of file.
sieve: info: started log at Mar 02 04:51:33.
main script: line 1: warning: no newline (CRLF) at end of hash comment at end of file.
sieve: info: started log at Mar 02 11:18:05.
main script: line 1: warning: no newline (CRLF) at end of hash comment at end of file.
sieve: info: started log at Mar 02 11:19:51.
main script: line 1: warning: no newline (CRLF) at end of hash comment at end of file.
sieve: info: started log at Mar 02 11:22:19.
main script: line 1: warning: no newline (CRLF) at end of hash comment at end of file.
sieve: info: started log at Mar 02 11:41:23.
main script: line 1: warning: no newline (CRLF) at end of hash comment at end of file.

1 Reply

I was able to get rid of the Milter error, but sorting still isn't working. Also, I no longer appear to be getting errors in .dovecot.sieve.log, so maybe those were due to the "Afterlogic" formatted script.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct