29 lines
825 B
Python
29 lines
825 B
Python
import smtplib
|
|
from email.mime.text import MIMEText
|
|
from email.mime.multipart import MIMEMultipart
|
|
|
|
sender_email = "ali.c.zeybek@gmail.com"
|
|
password = "crry mcte umao njgq".replace(" ", "") # Remove spaces
|
|
receiver_email = "ali.c.zeybek@gmail.com"
|
|
|
|
msg = MIMEMultipart("alternative")
|
|
msg["Subject"] = "Test Email"
|
|
msg["From"] = sender_email
|
|
msg["To"] = receiver_email
|
|
|
|
text = "This is a test email"
|
|
html = "<html><body><h1>Test Email</h1></body></html>"
|
|
|
|
msg.attach(MIMEText(text, "plain"))
|
|
msg.attach(MIMEText(html, "html"))
|
|
|
|
try:
|
|
server = smtplib.SMTP("smtp.gmail.com", 587)
|
|
server.starttls()
|
|
server.login(sender_email, password)
|
|
server.sendmail(sender_email, receiver_email, msg.as_string())
|
|
server.quit()
|
|
print("✅ Email sent successfully!")
|
|
except Exception as e:
|
|
print(f"❌ Failed: {e}")
|