import smtplib
from email.message import EmailMessage
# Email details
sender_email = "your_email@example.com" # Replace with your sender email
receiver_email = "nadav@nadavnishri.co.il"
subject = "הקובץ הערוך: גישור כאומנות לחימה"
body = "שלום נדב,\n\nהנה הקובץ הערוך של הספר 'גישור כאומנות לחימה'.\n\nבברכה,\nGhost Writer"
attachment_path = "/mnt/data/גישור כאומנות לחימה - ערוך.docx"
# Create email message
msg = EmailMessage()
msg["From"] = sender_email
msg["To"] = receiver_email
msg["Subject"] = subject
msg.set_content(body)
# Add attachment
with open(attachment_path, "rb") as f:
file_data = f.read()
file_name = "גישור כאומנות לחימה - ערוך.docx"
msg.add_attachment(file_data, maintype="application", subtype="vnd.openxmlformats-officedocument.wordprocessingml.document", filename=file_name)
# Send email
smtp_server = "smtp.gmail.com"
smtp_port = 587
smtp_username = "youremail@example.com" # Replace with your sender email
smtp_password = "yourpassword" # Replace with your email password
with smtplib.SMTP(smtp_server, smtp_port) as server:
server.starttls()
server.login(smtp_username, smtp_password)
server.send_message(msg)
attachment_path