File size: 1,035 Bytes
f84033a
02ccde5
 
 
a377469
02ccde5
a377469
 
 
 
 
 
 
 
 
 
02ccde5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#gmail_sender.py
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from smolagents import tool

@tool
def send_email(subject: str, body: str, to_email: str) -> None:
    """
        Send an email with a given subject and body to the specified address.

        Args:
            subject (str): The subject of the email.
            body (str): The plain text content of the email.
            to_email (str): The recipient's email address.
    """
    from_email = "alcmdrn7@gmail.com"
    password = "mgse lffk thsu hbxs"

    msg = MIMEMultipart()
    msg["From"] = from_email
    msg["To"] = to_email
    msg["Subject"] = subject

    msg.attach(MIMEText(body, "plain"))

    try:
        server = smtplib.SMTP("smtp.gmail.com", 587)
        server.starttls()
        server.login(from_email, password)
        server.send_message(msg)
        server.quit()
        print("✅ Plan başarıyla gönderildi.")
    except Exception as e:
        print(f"❌ Mail gönderilemedi: {e}")