linux - Postfix 后队列内容过滤器不起作用

标签 linux bash ubuntu mail-server postfix-mta

我在后缀 master.cf 中添加了以下行

filter unix - n n - 10 pipe flags=Rq user=filter null_sender= argv=/tmp/filter.sh -f ${sender} -- ${recipient}

我的测试脚本 filter.sh 代码如下所示:

#!/bin/sh
SENDMAIL="/usr/sbin/sendmail -G -i" # NEVER NEVER NEVER use "-t" here.
export HOME=/home/filter
SENDER="$2" #sender
shift
shift
shift
EMPFAENGER="$@" #empfaenger
#echo "SENDER=$SENDER" >> /tmp/logging.log
#echo "EMPFAE=$EMPFAENGER" >> /tmp/logging.log
touch itworked
cat | $SENDMAIL -f $SENDER -- $EMPFAENGER

当我发送电子邮件时,它会被传送,但它没有通过脚本传输。

有人知道我配置错了什么吗?

附言:

  • 用户“filter”存在并且他拥有脚本的所有权限。
  • Ubuntu 16.04.1
  • 已安装最新的 Mailcow,仅在本地使用

问候语 克里斯

最佳答案

你错过了一步。在你的配置文件 master.cf 中,第一个服务是:

smtp      inet  n       -       -       -       -       smtpd 

你必须告诉 postfix 你想使用你的 filter,所以:

smtp      inet  n       -       -       -       -       smtpd -o content_filter=filter

不要忘记在编辑此文件后执行postfix reload

关于linux - Postfix 后队列内容过滤器不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40363324/

相关文章:

linux - Oracle Linux 上的 ocfs2

c++ - 如何从 C/C++ 控制全局 OpenMP 设置?

linux - 在 linux 命令行中替换大文件第一行中字符串的最快方法?

c - 在 C 中通过命令行传递标点符号

linux - 加载已经插入内核的usb驱动

ubuntu - 如何修复 apt-get dist-upgrade 上的错误 400

ubuntu - 在 Ubuntu 中编译基于 OpenCV 和 ROS 的项目

linux - 如何使 xdotool 与 matchbow-window-manager 一起工作?

bash - 在 shell 中一行运行多个命令

vb.net - 我可以在 Ubuntu 上为 Visual C++ 和 Visual Basic 编写代码吗?