當前位置: 首頁>>代碼示例>>Python>>正文


Python Mailpile.message_compose方法代碼示例

本文整理匯總了Python中mailpile.Mailpile.message_compose方法的典型用法代碼示例。如果您正苦於以下問題:Python Mailpile.message_compose方法的具體用法?Python Mailpile.message_compose怎麽用?Python Mailpile.message_compose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mailpile.Mailpile的用法示例。


在下文中一共展示了Mailpile.message_compose方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: say

# 需要導入模塊: from mailpile import Mailpile [as 別名]
# 或者: from mailpile.Mailpile import message_compose [as 別名]
                   ['att:jpg', 'fimmtudaginn'],
                   ['subject:Moderation', 'kde-isl']):
        say('Searching for: %s' % search)
        results = mp.search(*search)
        assert(results.result['count'] == 1)

    # Make sure we are decoding weird headers correctly
    result_bre = mp.search(*FROM_BRE).result['messages'][0]
    result_bre = mp.view('=%s' % result_bre['mid']).result['messages'][0]
    say('Checking encoding: %s' % result_bre['from'])
    assert('=C3' not in result_bre['from'])
    say('Checking encoding: %s' % result_bre['message']['headers']['To'])
    assert('utf' not in result_bre['message']['headers']['To'])

    # Create a message...
    new_mid = mp.message_compose().result['messages'][0]['mid']
    assert(mp.search('tag:drafts').result['count'] == 0)
    assert(mp.search('tag:blank').result['count'] == 1)
    assert(mp.search('tag:sent').result['count'] == 0)
    assert(not os.path.exists(mailpile_sent))

    # Edit the message (moves from Blank to Draft, not findable in index)
    msg_data = {
      'from': [MY_FROM],
      'bcc': ['[email protected]'],
      'mid': [new_mid],
      'subject': ['This the TESTMSG subject'],
      'body': ['Hello world!']
    }
    mp.message_update(**msg_data)
    assert(mp.search('tag:drafts').result['count'] == 1)
開發者ID:arttarawork,項目名稱:Mailpile-1,代碼行數:33,代碼來源:mailpile-test.py

示例2: say

# 需要導入模塊: from mailpile import Mailpile [as 別名]
# 或者: from mailpile.Mailpile import message_compose [as 別名]
    result_bre = search_bre['data']['metadata'][search_bre['thread_ids'][0]]
    view_bre = mp.view('=%s' % result_bre['mid']).result
    metadata_bre = view_bre['data']['metadata'][view_bre['thread_ids'][0]]
    message_bre = view_bre['data']['messages'][view_bre['thread_ids'][0]]
    from_bre = search_bre['data']['addresses'][metadata_bre['from_aid']]
    say('Checking encoding: %s' % from_bre)
    assert('=C3' not in from_bre['fn'])
    assert('=C3' not in from_bre['address'])
    for key, val in message_bre['header_list']:
        if key.lower() not in ('from', 'to', 'cc'):
            continue
        say('Checking encoding: %s: %s' % (key, val))
        assert('utf' not in val)

    # Create a message...
    new_mid = mp.message_compose().result['thread_ids'][0]
    assert(mp.search('tag:drafts').result['stats']['count'] == 0)
    assert(mp.search('tag:blank').result['stats']['count'] == 1)
    assert(mp.search('tag:sent').result['stats']['count'] == 0)
    assert(not os.path.exists(mailpile_sent))

    # Edit the message (moves from Blank to Draft, not findable in index)
    msg_data = {
        'from': [MY_FROM],
        'bcc': ['[email protected]'],
        'mid': [new_mid],
        'subject': ['This the TESTMSG subject'],
        'body': ['Hello world!']
    }
    mp.message_update(**msg_data)
    assert(mp.search('tag:drafts').result['stats']['count'] == 1)
開發者ID:crameth,項目名稱:Mailpile,代碼行數:33,代碼來源:mailpile-test.py

示例3: say

# 需要導入模塊: from mailpile import Mailpile [as 別名]
# 或者: from mailpile.Mailpile import message_compose [as 別名]
    result_bre = search_bre["data"]["metadata"][search_bre["thread_ids"][0]]
    view_bre = mp.view("=%s" % result_bre["mid"]).result
    metadata_bre = view_bre["data"]["metadata"][view_bre["thread_ids"][0]]
    message_bre = view_bre["data"]["messages"][view_bre["thread_ids"][0]]
    from_bre = search_bre["data"]["addresses"][metadata_bre["from_aid"]]
    say("Checking encoding: %s" % from_bre)
    assert "=C3" not in from_bre["fn"]
    assert "=C3" not in from_bre["address"]
    for key, val in message_bre["header_list"]:
        if key.lower() not in ("from", "to", "cc"):
            continue
        say("Checking encoding: %s: %s" % (key, val))
        assert "utf" not in val

    # Create a message...
    new_mid = mp.message_compose().result["thread_ids"][0]
    assert mp.search("tag:drafts").result["stats"]["count"] == 0
    assert mp.search("tag:blank").result["stats"]["count"] == 1
    assert mp.search("tag:sent").result["stats"]["count"] == 0
    assert not os.path.exists(mailpile_sent)

    # Edit the message (moves from Blank to Draft, not findable in index)
    msg_data = {
        "from": [MY_FROM],
        "bcc": ["[email protected]"],
        "mid": [new_mid],
        "subject": ["This the TESTMSG subject"],
        "body": ["Hello world!"],
    }
    mp.message_update(**msg_data)
    assert mp.search("tag:drafts").result["stats"]["count"] == 1
開發者ID:vinchu,項目名稱:Mailpile,代碼行數:33,代碼來源:mailpile-test.py


注:本文中的mailpile.Mailpile.message_compose方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。