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