Skip to content

Latest commit

 

History

History
73 lines (55 loc) · 4.46 KB

Majordomo.md

File metadata and controls

73 lines (55 loc) · 4.46 KB
title
Majordomo

Using the "majordomo" helper

To be added to a list, a user simply sends a message to Majordomo. A "majordomo" control user is created when the first mailing list is generated.

To: [email protected]
Body: subscribe listname

Conversely, to unsubscribe, send an email to [email protected] with the body "unsubscribe listname".

To list all available commands, send an email with an empty subject line and the body "help". Majordomo will only respond to the email address present in the list (or configured as administrator). By default, the administrator is the Site Administrator email address (Account > Settings). This value may be altered by the moderator configuration value in Majordomo.

Delivery lifecycle

Setup: assuming a mailing list named [email protected] and membership consisting of [email protected], [email protected]. Users may be added within ApisCP via Mailing Lists > Edit > Edit Membership

  1. Mail is received on the list name from an authorized sender, [email protected]
  2. List name is a system alias that expands to the Majordomo wrapper of the form test-list+apnscp.com
  3. Majordomo wrapper is invoked from alias expansion in /etc/aliases to env HOME=/usr/lib/majordomo /usr/lib/majordomo/wrapper resend -C /home/virtual/site1/fst/etc/majordomo-apnscp.com.cf -l test-list -h apnscp.com test-list-outgoing+apnscp.com
  4. For each user in siteXX/var/lib/majordomo/lists/NAME, an email is generated

Simulating a delivery

Majordomo's wrapper /usr/lib/majordomo/majordomo may be invoked directly with a sample email to evaluate its behavior.

env HOME=/usr/lib/majordomo /usr/lib/majordomo/wrapper resend -C /home/virtual/site1/fst/etc/majordomo-apnscp.com.cf -l test-list -h apnscp.com test-list-outgoing+apnscp.com <<- EOF
To: [email protected]
From: [email protected]
Subject: ABC
Message-ID: <[email protected]>
Date: Wed, 12 Feb 2020 02:44:19 -0600

Test message
EOF

::: tip

The sender's address (From:) must be a member of the mailing list to avoid rejection. siteXX/var/lib/majordomo/lists/NAME contain all members for a given list.

:::

Correspondingly, log entries are generated in /var/log/maillog with the activity:

Feb 12 03:53:35 nexus postfix/pickup[5484]: 7451AA0400: uid=0 from=<[email protected]>
Feb 12 03:53:35 nexus postfix/cleanup[17775]: 7451AA0400: message-id=<[email protected]>
Feb 12 03:53:35 nexus postfix/qmgr[1630]: 7451AA0400: from=<[email protected]>, size=366, nrcpt=1 (queue active)
Feb 12 03:53:35 nexus postfix/cleanup[17775]: 87DCEA0419: message-id=<[email protected]>
Feb 12 03:53:35 nexus postfix/local[17782]: 7451AA0400: to=<[email protected]>, orig_to=<test-list-outgoing+apnscp.com>, relay=local, delay=0.1, delays=0.07/0.02/0/0.01, dsn=2.0.0, status=sent (forwarded as 87DCEA0419)
Feb 12 03:53:35 nexus postfix/qmgr[1630]: 87DCEA0419: from=<[email protected]>, size=544, nrcpt=2 (queue active)
Feb 12 03:53:35 nexus postfix/qmgr[1630]: 7451AA0400: removed
Feb 12 03:53:35 nexus postfix/smtp[17783]: 87DCEA0419: to=<[email protected]>, orig_to=<test-list-outgoing+apnscp.com>, relay=mail.apisnetworks.com[64.22.68.206]:25, delay=0.43, delays=0.01/0.02/0.08/0.33, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as B8BC12C8900)
Feb 12 03:53:35 nexus postfix/smtp[17783]: 87DCEA0419: to=<[email protected]>, orig_to=<test-list-outgoing+apnscp.com>, relay=mail.apisnetworks.com[64.22.68.206]:25, delay=0.43, delays=0.01/0.02/0.08/0.33, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as B8BC12C8900)
Feb 12 03:53:35 nexus postfix/qmgr[1630]: 87DCEA0419: removed

Let's break this down:

  • Line 1: message is generated by majordomo command.
  • Line 2: message has been received by Postfix. Any local rewrites are completed.
  • Line 3: message enqueued into Postfix's queue manager
  • Line 5: message dispatched to Majordomo's generated nexthop, test-list-outgoing+apnscp.com (orig_to=/to= translation occurs during the cleanup task on line 4).
  • Line 6: test-list members are enumerated, generating 2 new mails (nrcpt=2)
  • Line 7: initial email to test-list-outgoing+apnscp.com has completed successfully and is now discarded from Postfix.
  • Line 8-9: emails are generated for each member in the list.
  • Line 10: test-list members have been enumerated successfully. The message is now discarded from Postfix.

More information on reading Postfix logs is provided in Smtp.md.