[email] Send messages to email recipients

This commit is contained in:
maike 2020-07-06 16:31:30 +02:00 committed by dl6tom
parent 1033b778aa
commit 78b271c418

View file

@ -5,6 +5,7 @@
from kibicara.platforms.email.model import EmailRecipients, Email from kibicara.platforms.email.model import EmailRecipients, Email
from kibicara.platformapi import Censor, Spawner, Message from kibicara.platformapi import Censor, Spawner, Message
from logging import getLogger from logging import getLogger
from kibicara.email import send_email
logger = getLogger(__name__) logger = getLogger(__name__)
@ -18,8 +19,8 @@ class EmailBot(Censor):
async def run(self): async def run(self):
while True: while True:
message = await self.receive() message = await self.receive()
print("push " + message.text) for recipient in EmailRecipients(hood=self.hood):
# send message to everyone in EmailRecipients(hood=self.hood) send_email(recipient.email, "Kibicara " + self.hood, body=message.text)
spawner = Spawner(Email, EmailBot) spawner = Spawner(Email, EmailBot)