exchangelib中Messages的更改密钥是什么?

时间:2017-08-11 08:04:11

标签: python email exchange-server exchangelib

我正在尝试向用户提供有关他们在同一对话中以电子邮件形式收到的电子邮件的其他信息。

我做什么

from exchangelib import Message

# Works:
account = Account(primary_smtp_address=smtp_address, config=config,
                  autodiscover=False, access_type=DELEGATE)
mail = A message received under account

# Works, but probably needs adjustment:
m = Message(account=account,
            subject=mail.subject,
            conversation_id=mail.conversation_id,
            body='Test',
            to_recipients=[account.primary_smtp_address])

# Throws error below
m.send()

我得到了

Traceback (most recent call last):
  File "myscript.py", line 114, in myfunction
    m.send()
  File "/usr/local/lib/python2.7/dist-packages/exchangelib/items.py", line 507, in send
    res = self._create(message_disposition=SEND_ONLY, send_meeting_invitations=send_meeting_invitations)
  File "/usr/local/lib/python2.7/dist-packages/exchangelib/items.py", line 176, in _create
    send_meeting_invitations=send_meeting_invitations)
  File "/usr/local/lib/python2.7/dist-packages/exchangelib/account.py", line 260, in bulk_create
    send_meeting_invitations=send_meeting_invitations,
  File "/usr/local/lib/python2.7/dist-packages/exchangelib/account.py", line 254, in <genexpr>
    i if isinstance(i, Exception)
  File "/usr/local/lib/python2.7/dist-packages/exchangelib/services.py", line 451, in _pool_requests
    elems = r.get()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 567, in get
    raise self._value
ValueError: 'changekey' is a required field with no default

问题是什么,我该如何解决?

1 个答案:

答案 0 :(得分:0)

问题在于我设置了conversation_id。如果我只希望在同一个对话中显示消息,则实际上没有必要设置对话ID。仅将主题线设置为完全相同似乎就足够了。