Python 3.12.3 Код на основе документации pyOutlook [code]from pyOutlook import OutlookAccount, Contact
token = "..."
account = OutlookAccount(token) account.messages.send( subject='Hey there', body="I'm sending an email through Python. Best, Me", to=['me@somewhere.com'] ) [/code] Полное сообщение об ошибке: [code]--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) File c:\...\pyOutlook-test.py:6 3 token = "..." 5 account = OutlookAccount(token) ----> 6 account.messages.send( 7 subject='Hey there', 8 body="I'm sending an email through Python. Best, Me", 9 to=['me@somewhere.com'] 10 )
File c:\...\anaconda3\Lib\site-packages\pyOutlook\services\message.py:174, in MessageService.send(self, subject, body, to, cc, bcc, attachments) 157 def send(self, subject: str, body: str, to: list[Contact], cc: list[Contact] | None = None, 158 bcc: list[Contact] | None = None, attachments: list['Attachment'] | None = None) -> None: 159 '''Sends a message. 160 161 Args: (...) 166 bcc: The list of BCC recipients 167 ''' 168 payload: dict[str, object] = { 169 'subject': subject, 170 'body': { 171 'contentType': 'HTML', 172 'content': body ... 175 } 176 if cc: 177 payload['ccRecipients'] = [contact.api_representation() for contact in cc]
AttributeError: 'str' object has no attribute 'api_representation' [/code] Я также попробовал ...to=[Contact('me@somewhere.com', name='myself')] с той же ошибкой.