kootenpv / aioyagmail

makes sending emails very easy by doing all the magic for you, asynchronously
MIT License
30 stars 3 forks source link

AttributeError: 'AIOSMTP' object has no attribute 'smtp' #2

Open firs-iln opened 1 year ago

firs-iln commented 1 year ago

I'm trying to notify all emails in some list on some event. Here's the code:

mail = AIOSMTP(SENDER_EMAIL, PASSWORD)
for admin in EMAILS_TO_NOTIFY:
    await mail.send(to=admin, contents=NOTIFICATION_TEXT)
await mail.close()

Here's exception trace:

Traceback (most recent call last):
  File "venv/lib/python3.11/site-packages/telethon/client/updates.py", line 570, in _dispatch_update
    await callback(event)
  File "main.py", line 62, in main
    await mail.send(to=admin, contents=NOTIFICATION_TEXT)
  File "venv/lib/python3.11/site-packages/aioyagmail/aio.py", line 51, in send
    return await self._attempt_send(recipients, msg_string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv/lib/python3.11/site-packages/aioyagmail/aio.py", line 57, in _attempt_send
    result = await self.smtp.sendmail(self.user, recipients, msg_string)
                   ^^^^^^^^^
AttributeError: 'AIOSMTP' object has no attribute 'smtp'

What am I doing wrong?

mcsham commented 4 months ago

I also have this problem