def test_archive_enqueue(): msg = MailResponse(From=u'"p\xf6stal Zed" <*****@*****.**>', To="*****@*****.**", Subject="test message", Body="This is a test.") archive.enqueue('test.list', msg) archived = delivered('zedshaw', to_queue=queue(queue_path)) assert archived, "Didn't get archived." as_string = str(archived) assert '-AT-' in str(archived), "Didn't get obfuscated" assert '<' in as_string and '"' in as_string and '>' in as_string, "Unicode email screwed up."
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
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