import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
def send_email(subject, body, to_email):
# Set up SMTP server credentials
smtp_server = 'smtp.gmail.com'
smtp_port = 587
smtp_username = 'laxminarayanarath5@gmail.com'
smtp_password = 'laxhackcreate105@LH'
# Create message container
msg = MIMEMultipart()
msg['From'] = smtp_username
msg['To'] = to_email
msg['Subject'] = subject
msg.attach(MIMEText(body, 'plain'))
# Connect to SMTP server and send email
with smtplib.SMTP(smtp_server, smtp_port) as server:
server.starttls()
server.login(smtp_username, smtp_password)
server.sendmail(smtp_username, to_email, msg.as_string())
# Example usage:
if __name__ == "__main__":
# Example data
subject = "prachi, Au kn prachi sabu bhala ta,au ame au kheli /chala gote game"
body = "prachi, Au kn prachi sabu bhala ta,au ame au kheli /chala gote game kheliba"
to_email = 'prachipratikshyadash@gmail.com'
# Send email
send_email(subject, body, to_email)
Comments
Post a Comment