python - 我如何知道我的 mailman post 使用 gmail 是否成功?

标签 python command-line mailman

如果您使用 gmail 向 mailman 邮件列表发帖,您将不会在收件箱中收到您自己的邮件,因为它会立即存档。有很多关于 Gmail 对此行为的提示,但直到现在您也无能为力。

是否还有可能获得对您的帖子的致谢?

(请注意,如果列表版主需要一些时间才能接受您的帖子,您可能希望在邮件发送给列表订阅者时得到通知。)

最佳答案

只为自己启用确认

有一个option in mailman这将使 postman 在您的邮件送达时告诉您:

How can I get Mailman to tell me when my post has been received by the list? (ack option)

[...]

To set this using the email interface:

Send a mail to LISTNAME-request@DOMAIN with the command set ack on or set ack off.

通过命令行为所有用户更改它

但是,如果您是 postman 列表的管理员,甚至是运行许多 postman 列表的服务器的管理员,您可能希望为列表中的所有 gmail 用户更改此选项。在这种情况下,以下脚本可能会帮助您通过命令行自动更改选项。

  • 将以下行保存到 /usr/lib/mailman/bin/ackpostforgmail.py(文件名很重要!将 /usr/lib/mailman 替换为你的 mailman 安装路径!)
  • cd/usr/lib/mailman/bin/
  • sudo withlist -r ackpostforgmail LISTNAME

    # Call this script with:
    # cd /usr/lib/mailman/bin/
    # withlist -r ackpostforgmail LISTNAME
    
    from Mailman import mm_cfg
    
    def ackpostforgmail(m):
        # m is the maillist object for the list LISTNAME
    
        # We need to lock the list, since we want to change something...
        m.Lock()
    
        print "Setting 'AcknowledgePosts' to True for all gmail adresses of the list..."
        for memb in m.members:
            # If the mailadress memb contains 'gmail'...
            if 'gmail' in memb:
                # ...set the ackpost option...
                prev_state = m.getMemberOption(memb, mm_cfg.AcknowledgePosts)
                m.setMemberOption(memb, mm_cfg.AcknowledgePosts,True)
                after_state = m.getMemberOption(memb, mm_cfg.AcknowledgePosts)
    
                print "%s: %s -> %s" % (memb, prev_state, after_state)
    
        m.Save()
    

如果您想对所有列表运行此操作,您可能需要为 with_list 命令添加 -a 标志。否则,list_lists 命令可能有助于您查找正在运行的列表。

关于python - 我如何知道我的 mailman post 使用 gmail 是否成功?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15281965/

相关文章:

python - 使用 append 从另外两个创建 pandas dataFrame

windows - 使用 mklink 将一个文件夹中的 dll 文件符号链接(symbolic link)到另一个文件夹

windows - 如何在git bash下更改目录

Python 语言在我返回的输出中打印 set()

python - "No module named"。 gdb 中的 Python 错误

bash - 如何在 bash 中提示是或否?

bash - docker容器中的文件消失

centos - 通过 CentOs 配置 cyrus imapd 进程

ruby-on-rails - Ruby:如何妖魔化 MailMan(传入邮件处理微框架)

python - QT python连接传递参数给函数