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


Python Mailpile.sendmail方法代碼示例

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


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

示例1: assert

# 需要導入模塊: from mailpile import Mailpile [as 別名]
# 或者: from mailpile.Mailpile import sendmail [as 別名]
        '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)
    assert(mp.search('tag:blank').result['stats']['count'] == 0)
    assert(mp.search('TESTMSG').result['stats']['count'] == 0)
    assert(not os.path.exists(mailpile_sent))

    # Send the message (moves from Draft to Sent, is findable via. search)
    del msg_data['subject']
    msg_data['body'] = ['Hello world: thisisauniquestring :)']
    mp.message_update_send(**msg_data)
    mp.sendmail()
    assert(mp.search('tag:drafts').result['stats']['count'] == 0)
    assert(mp.search('tag:blank').result['stats']['count'] == 0)
    assert('the TESTMSG subject' in contents(mailpile_sent))
    assert('thisisauniquestring' in contents(mailpile_sent))
    assert(MY_FROM in grep('X-Args', mailpile_sent))
    assert('[email protected]' in grep('X-Args', mailpile_sent))
    assert('[email protected]' not in grepv('X-Args', mailpile_sent))
    for search in (['tag:sent'],
                   ['bcc:[email protected]'],
                   ['thisisauniquestring'],
                   ['subject:TESTMSG']):
        say('Searching for: %s' % search)
        assert(mp.search(*search).result['stats']['count'] == 1)
    os.remove(mailpile_sent)
開發者ID:crameth,項目名稱:Mailpile,代碼行數:32,代碼來源:mailpile-test.py


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