Spaces:
Build error
Build error
| #gmail_sender.py | |
| import smtplib | |
| from email.mime.text import MIMEText | |
| from email.mime.multipart import MIMEMultipart | |
| from smolagents import 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}") | |