|
import smtplib |
|
from email.mime.multipart import MIMEMultipart |
|
from email.mime.text import MIMEText |
|
import config |
|
|
|
class Notifier: |
|
def send_comprehensive_report(self, summary, action_items, decisions, transcript, recipients): |
|
|
|
action_items_text = "\n".join( |
|
f"- {item['task']} (Owner: {item['owner']}, Deadline: {item['deadline']})" |
|
for item in action_items |
|
) |
|
|
|
|
|
decisions_text = "\n".join(f"- {decision}" for decision in decisions) |
|
|
|
|
|
text_content = f""" |
|
Meeting Summary: |
|
{summary} |
|
|
|
Action Items: |
|
{action_items_text} |
|
|
|
Key Decisions: |
|
{decisions_text} |
|
|
|
Full Transcript: |
|
{transcript} |
|
""" |
|
|
|
|
|
for recipient in recipients: |
|
if recipient["type"] == "email": |
|
self._send_email( |
|
recipient["address"], |
|
"Meeting Summary & Action Items", |
|
text_content |
|
) |
|
|
|
def send_urgent_alert(self, action_items): |
|
for recipient in config.NOTIFICATION_RECIPIENTS: |
|
if recipient["type"] == "email": |
|
self._send_email_alert(recipient["address"], action_items) |
|
|
|
def _send_email(self, to_address, subject, text_content): |
|
msg = MIMEMultipart() |
|
msg['From'] = config.EMAIL_SENDER |
|
msg['To'] = to_address |
|
msg['Subject'] = subject |
|
|
|
msg.attach(MIMEText(text_content, 'plain')) |
|
|
|
with smtplib.SMTP(config.SMTP_SERVER, config.SMTP_PORT) as server: |
|
server.starttls() |
|
server.login(config.EMAIL_SENDER, config.EMAIL_PASSWORD) |
|
server.send_message(msg) |
|
|
|
def _send_email_alert(self, to_address, action_items): |
|
subject = "URGENT: Action Item Detected in Meeting" |
|
|
|
|
|
items_text = "\n".join(f"• {item['task']}" for item in action_items) |
|
|
|
body = f""" |
|
Urgent action items were detected during the meeting: |
|
|
|
{items_text} |
|
|
|
Please address these immediately. |
|
""" |
|
|
|
msg = MIMEMultipart() |
|
msg['From'] = config.EMAIL_SENDER |
|
msg['To'] = to_address |
|
msg['Subject'] = subject |
|
msg.attach(MIMEText(body, 'plain')) |
|
|
|
with smtplib.SMTP(config.SMTP_SERVER, config.SMTP_PORT) as server: |
|
server.starttls() |
|
server.login(config.EMAIL_SENDER, config.EMAIL_PASSWORD) |
|
server.send_message(msg) |