我正在尝试使用Python脚本处理所有传入的电子邮件(针对特定的全部帐户 - 垃圾邮件)。 我已经听过其他几个在线问题的建议 (here,here)
但我似乎无法让脚本运行。
如果我:cat mytestemail | path_to_my/script.py
脚本将针对mytestemail运行
但是当我将条目添加到/ etc / aliases时,似乎没有任何事情发生。
Postfix配置为使用虚拟别名映射,因此我不确定它是否与/ etc / aliases不同 - 无论如何,我已经尝试配置这两个文件。
我希望脚本能够处理所有发送到“垃圾邮件”文件夹的电子邮件。
这是virtual-alias-maps文件的样子:
user1@mydomain.com user1
user2@mydomain.com user2
@mydomain.com spam
spam |/home/ubuntu/Script.py
这是别名文件的样子:
# See man 5 aliases for format
postmaster: webmaster@mydomain.com
spam: |/home/ubuntu/Script.py
将条目添加到虚拟别名映射可防止邮件传递,但只是将文件添加到/ etc / aliases似乎什么都不做。
这是我的main.cf
的剥离版本# Debian specific -- Default PostFix settings
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
inet_interfaces = all
mailbox_command = /usr/lib/dovecot/deliver -c /etc/dovecot/dovecot.conf -m "${EXTENSION}"
mailbox_size_limit = 0
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_path = private/dovecot-auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_type = dovecot
#Customized Dovecot and virtual user-specific settings
canonical_maps = hash:/etc/postfix/canonical
home_mailbox = Maildir/
message_size_limit = 104857600
virtual_alias_maps = hash:/etc/postfix/virtual-alias-maps
virtual_mailbox_domains = hash:/etc/postfix/virtual-mailbox-domains
virtual_transport = dovecot
## This setting will generate an error if you restart Postfix before adding the appropriate service definition in master.cf, so make sure you get that taken care of
dovecot_destination_recipient_limit = 1
## Customized milter settings
milter_default_action = accept
milter_connect_macros = j {daemon_name} v {if_name} _
non_smtpd_milters = $smtpd_milters
smtpd_milters = unix:/opendkim/opendkim.sock
# Other customized mail server settings
default_destination_concurrency_limit = 5
disable_vrfy_command = yes
relay_destination_concurrency_limit = 1
# Unused Settings
defer_unauth_destination
有什么想法吗?
答案 0 :(得分:0)
使用sendmail -bv
调试问题
(postfix提供的sendmail命令)
当本地OS用户执行/usr/sbin/sendmail -bv no-such-user@mydomain.com
它应该显示重写链的哪个部分不能按预期工作
(虚拟别名 - >本地别名 - >命令)