File size: 3,022 Bytes
3c40d6a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32aa6aa
 
 
3c40d6a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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):
        # Create HTML content
        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>
        """
        
        # Send to all requested channels
        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)