Пример #1
0
def POSTING(message, list_name=None, id_number=None, host=None):

    """
    Takes a message and posts it to the rest of the group. If there
    are multiple email addresses in the To or CC field, those emails
    will be added to the list.

    We also ensure that they don't receive a duplicate of the
    email they were just sent.
    """

    #an existing user is adding themselves to another group.
    if id_number:
        START(message, list_name=list_name, id_number=id_number, host=None)

    else:

        list_addr = "%s@%s" % (list_name, host)
        if mailinglist.is_subscribed(message['from'], list_name) and mailinglist.is_active(list_name):
            mlist = mailinglist.find_list(list_name)

        #send a request for confirmation to anyone cc'd on this list so they can
        #join the group if they want.    
            allrecpts = mailinglist.all_recpts(message)
            for address in [to for to in allrecpts if not to.endswith(host)]:
                CONFIRM.send_if_not_subscriber(relay, mlist, 'confirm', address, 'postosaurus/join-confirmation.msg', host)

            delivery = mailinglist.craft_response(message, list_name, list_addr)
            mailinglist.post_message(relay, message, delivery, list_name, host, message['from'])

            q = queue.Queue("run/work")
            q.push(message)

    return POSTING
Пример #2
0
def POSTING(message, list_name=None, action=None, host=None):
    if action == 'unsubscribe':
        action = "unsubscribe from"
        CONFIRM.send(relay, list_name, message, 'mail/confirmation.msg',
                          locals())
        return CONFIRMING_UNSUBSCRIBE
    else:
        mailinglist.post_message(relay, message, list_name, host)
        # archive makes sure it gets cleaned up before archival
        final_msg = mailinglist.craft_response(message, list_name, 
                                               list_name + '@' + host)
        archive.enqueue(list_name, final_msg)
        return POSTING
Пример #3
0
def POSTING(message, list_name=None, action=None, host=None):
    if action == 'unsubscribe':
        action = "unsubscribe from"
        CONFIRM.send(relay, list_name, message, 'mail/confirmation.msg',
                     locals())
        return CONFIRMING_UNSUBSCRIBE
    else:
        mailinglist.post_message(relay, message, list_name, host)
        # archive makes sure it gets cleaned up before archival
        final_msg = mailinglist.craft_response(message, list_name,
                                               list_name + '@' + host)
        archive.enqueue(list_name, final_msg)
        return POSTING
Пример #4
0
def POSTING(message, group_name=None, action=None, topic=None, host=None):
    #group_name = group_name.lower() if group_name else None
    #action = action.lower() if action else None
    host = host.lower() if host else None

    if topic == 'unsubscribe':
        topic = "unsubscribe from"
        CONFIRM.send(relay, group_name, message, 'mail/confirmation.msg',
                          locals())
        return CONFIRMING_UNSUBSCRIBE
    else:
        mailinglist.post_message(relay, message, group_name, host)
        # archive makes sure it gets cleaned up before archival
        final_msg = mailinglist.craft_response(message, group_name, 
                                               group_name + '@' + host)
        archive.enqueue(group_name, final_msg)
        # TODO: Save message in DB?
        # TODO: if topic: Link message to topic, attach message attachments to topic 
        return POSTING