|
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_html = "<ul>" |
|
for item in action_items: |
|
action_items_html += f""" |
|
<li> |
|
<strong>{item['task']}</strong><br> |
|
Owner: {item['owner']} | Deadline: {item['deadline']} |
|
</li> |
|
""" |
|
action_items_html += "</ul>" |
|
|
|
html = f""" |
|
<html> |
|
<body> |
|
<h2>Meeting Summary</h2> |
|
<p>{summary}</p> |
|
|
|
<h2>Action Items</h2> |
|
{action_items_html} |
|
|
|
<h2>Key Decisions</h2> |
|
<p>{', '.join(decisions)}</p> |
|
|
|
<h2>Full Transcript</h2> |
|
<pre>{transcript}</pre> |
|
|
|
<p>Generated by MeetingMate AI</p> |
|
</body> |
|
</html> |
|
""" |
|
|
|
|
|
for recipient in recipients: |
|
if recipient["type"] == "email": |
|
self._send_email( |
|
recipient["address"], |
|
"Meeting Summary & Action Items", |
|
html |
|
) |
|
|
|
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, html_content): |
|
msg = MIMEMultipart() |
|
msg['From'] = config.EMAIL_SENDER |
|
msg['To'] = to_address |
|
msg['Subject'] = subject |
|
|
|
msg.attach(MIMEText(html_content, 'html')) |
|
|
|
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']} (Owner: {item['owner']}, Deadline: {item['deadline']})" |
|
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) |