i have already install postfix, dovecot, Clamav, Spamassassin and amavisd-new on my centos 5.10. The tutorial is in here : http://catatanlepas.com/komputer/aplikasi/server-mail/postfix/359-instalasi-postfix-menggunakan-dovecot-di-centos-5-5
I just not install Razor, Pyzor, dan DCC on that tutorial.
Everything is work fine in /var/log/maillog, if there is a spam email n not come to inbox, but i want to move spam email to spam folder.
My Question is : 1. How to auto create spam folder on my webmail because it is just create inbox, draft and sent item only and there is no spam folder on my webmail. 2. How to move spam email to that spam folder per user (i create user on /var/vmail)
Please help me, i have search in google for a 5 days and i am stack on this :(
Thank you.
All you have to do is right-click the email that you want to move and select move to inbox. That will move the email to the inbox and it will tell Windows Mail that you want emails from that sender to go to your inbox in the future instead of to the spam or junk folder.
The first is through the conversation actions while viewing the message. Hit the More actions button, then Move to Spam. You can also access this through the message list. Select one or more messages that you'd like to move, hit the Move button, then select the Spam folder.
I - Set your email delivery to use Dovecot LDA:
The original website the OP linked is offline, however I believe the email delivery was happening over sendmail
program, which it should be done over Dovecot LDA for what you need. (To avoid email origin header changes).
Edit Postfix's master.cf
(at the beginning):
smtp inet n - - - - smtpd -o content_filter=spamassassin
And at the end of the file:
spamassassin unix - n n - - pipe
flags=DROhu user=vmail:vmail argv=/usr/bin/spamc -f -e
/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}
Now edit Postfix's main.cf
and add (optional, check (3) bellow):
spamassassin_destination_recipient_limit = 1
Now your email will be delivered via Dovecot LDA without header changes. For the curious ones, here are some details on my config:
[email protected]
will be delivered into [email protected]
inbox) - That's why I added -d ${user}@${nexthop}
this will remove the +
and everything until the domain. To enable this feature, also be sure to add recipient_delimiter = +
into main.cf
;flags=DROhu
, they don't add anything abnormal but they can be understood here: http://www.postfix.org/pipe.8.html;spamassassin_destination_recipient_limit = 1
is required to make sure that every recipient gets individually processed by spamassassin. This is required due due to the D
flag above (Includes X-Original-To
header). If you don't care about this header you can remove the flag and this isn't needed.II - Move your SPAM to the Junk
folder:
(With some help from @Electronic Technologies at https://stackoverflow.com/a/32470349/560745)
You can also configure Dovecot to move email detected as SPAM to the Junk
IMAP folder. Just follow this:
Edit /etc/dovecot/conf.d/15-mailboxes.conf
and uncomment / add the Junk
folder with (should be on the namespace inbox
section near mailbox Trash
):
mailbox Junk {
special_use = \Junk
}
Install dovecot-sieve
with apt-get install dovecot-sieve
;
Edit /etc/dovecot/conf.d/90-sieve.conf
and comment the line: #sieve = ~/.dovecot.sieve
Edit /etc/dovecot/conf.d/90-plugin.conf
as:
plugin {
sieve = /etc/dovecot/sieve/default.sieve
}
Edit /etc/dovecot/conf.d/15-lda.conf
and /etc/dovecot/conf.d/20-lmtp.conf
to match:
protocol lda/lmtp { # do not copy/paste this line!
mail_plugins = $mail_plugins sieve
}
WARNING: You might have another settings under the protocol
selections, keep them. The line protocol lda/lmtp
changes in the files, keep the original.
Create folder /etc/dovecot/sieve/
Create file /etc/dovecot/sieve/default.sieve
with this content:
require "fileinto";
if header :contains "X-Spam-Flag" "YES" {
fileinto "Junk";
}
Change folder permissions to your virtual email user and group like: chown vmail:vmail /etc/dovecot/sieve/ -R
. If you miss this dovecot will complain!
Restart everything: service postfix restart; service dovecot restart; service spamassassin restart
Try to send an email to some email on the server (from an external server), first a normal email and then another one with this subject: XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
. The second email should to into the Junk
folder and the first to your inbox.
If this doesn't work at your first try, look at the logs: tail -f /var/log/mail.log
and send the email while tail
is running. A good working setup should report stored mail into mailbox 'INBOX'
or stored mail into mailbox 'Junk'
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With