Collect the initialization of adapters into a separate method.
[mailman.git] / mailman / commands / docs / join.txt
blob4cc805e9996c0dc29f10ba135f6a357a3ed44623
1 The 'join' command
2 ==================
4 The mail command 'join' subscribes an email address to the mailing list.
5 'subscribe' is an alias for 'join'.
7     >>> from mailman.configuration import config
8     >>> command = config.commands['join']
9     >>> print command.name
10     join
11     >>> print command.description
12     Join this mailing list.  You will be asked to confirm your subscription
13     request and you may be issued a provisional password.
14     <BLANKLINE>
15     By using the 'digest' option, you can specify whether you want digest
16     delivery or not.  If not specified, the mailing list's default will be
17     used.  You can also subscribe an alternative address by using the
18     'address' option.  For example:
19     <BLANKLINE>
20         join address=myotheraddress@example.com
21     <BLANKLINE>
22     >>> print command.argument_description
23     [digest=<yes|no>] [address=<address>]
26 No address to join
27 ------------------
29     >>> from mailman.Message import Message
30     >>> from mailman.app.lifecycle import create_list
31     >>> from mailman.queue.command import Results
32     >>> mlist = create_list(u'test@example.com')
34 When no address argument is given, the message's From address will be used.
35 If that's missing though, then an error is returned.
37     >>> results = Results()
38     >>> print command.process(mlist, Message(), {}, (), results)
39     ContinueProcessing.no
40     >>> print unicode(results)
41     The results of your email command are provided below.
42     <BLANKLINE>
43     join: No valid address found to subscribe
44     <BLANKLINE>
46 The 'subscribe' command is an alias.
48     >>> subscribe = config.commands['subscribe']
49     >>> print subscribe.name
50     subscribe
51     >>> results = Results()
52     >>> print subscribe.process(mlist, Message(), {}, (), results)
53     ContinueProcessing.no
54     >>> print unicode(results)
55     The results of your email command are provided below.
56     <BLANKLINE>
57     subscribe: No valid address found to subscribe
58     <BLANKLINE>
61 Joining the sender
62 ------------------
64 When the message has a From field, that address will be subscribed.
66     >>> msg = message_from_string("""\
67     ... From: Anne Person <anne@example.com>
68     ...
69     ... """)
70     >>> results = Results()
71     >>> print command.process(mlist, msg, {}, (), results)
72     ContinueProcessing.yes
73     >>> print unicode(results)
74     The results of your email command are provided below.
75     <BLANKLINE>
76     Confirmation email sent to Anne Person <anne@example.com>
77     <BLANKLINE>
79 Anne is not yet a member because she must confirm her subscription request
80 first.
82     >>> print config.db.user_manager.get_user(u'anne@example.com')
83     None
85 Mailman has sent her the confirmation message.
87     >>> from mailman.queue import Switchboard
88     >>> virginq = Switchboard(config.VIRGINQUEUE_DIR)
89     >>> qmsg, qdata = virginq.dequeue(virginq.files[0])
90     >>> print qmsg.as_string()
91     MIME-Version: 1.0
92     ...
93     Subject: confirm ...
94     From: confirm-...@example.com
95     To: anne@example.com
96     ...
97     <BLANKLINE>
98     Email Address Registration Confirmation
99     <BLANKLINE>
100     Hello, this is the GNU Mailman server at example.com.
101     <BLANKLINE>
102     We have received a registration request for the email address
103     <BLANKLINE>
104         anne@example.com
105     <BLANKLINE>
106     Before you can start using GNU Mailman at this site, you must first
107     confirm that this is your email address.  You can do this by replying to
108     this message, keeping the Subject header intact.  Or you can visit this
109     web page
110     <BLANKLINE>
111         http://www.example.com/confirm/...
112     <BLANKLINE>
113     If you do not wish to register this email address simply disregard this
114     message.  If you think you are being maliciously subscribed to the list, or
115     have any other questions, you may contact
116     <BLANKLINE>
117         postmaster@example.com
118     <BLANKLINE>
120 Once Anne confirms her registration, she will be made a member of the mailing
121 list.
123     >>> token = str(qmsg['subject']).split()[1].strip()
124     >>> from mailman.interfaces.registrar import IRegistrar
125     >>> registrar = IRegistrar(config.domains['example.com'])
126     >>> registrar.confirm(token)
127     True
129     >>> user = config.db.user_manager.get_user(u'anne@example.com')
130     >>> print user.real_name
131     Anne Person
132     >>> list(user.addresses)
133     [<Address: Anne Person <anne@example.com> [verified] at ...>]