Search code examples
pythoncommand-linemailman

How do I know if my mailman post was succesful using gmail?


If you post to a mailman mail list using gmail, you won't receive your own mail in the inbox, since it's immediately archived. There are many complaints about Gmail's behaviour about this, but until now there's nothing you can do about.

Is there still a possible way of getting acknowledgements for your posts?

(Note that if it takes some time until the list moderator accepts your post, you might want to be informed when your mail is delivered to the subscribers of the list.)


Solution

  • Enable acknowledgement only for yourself

    There is an option in mailman which will make mailman to tell you when your mail was delivered:

    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.

    Change it for all users via command line

    But if you are the admin of a mailman list or even of a server running many mailman lists, you might want to change this option for all gmail users in your list. In this case the following script might help you to change the option automatically via command line.

    • Save the following lines to a /usr/lib/mailman/bin/ackpostforgmail.py (The filename is important! Replace /usr/lib/mailman with the path of your mailman installation!)
    • 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()
      

    If you would like to run this for all your lists, you might want to the -a flag for the with_list command. Otherwise the list_lists command might be helpful for you to look up which lists you are running.