Untitled
unknown
plain_text
7 months ago
886 B
1
Indexable
Never
sender_email = "shankar.mulakalapalli@gmail.com" receiver_email = "coe@celebaltech.com" cc = ["chayan.sharma@celebaltech.com"] password = "" msg = MIMEMultipart() msg["from"] = sender_email msg["to"] = receiver_email msg["Cc"] = ', '.join(cc) msg["Subject"] = "COE Python Evaluation Files" files = ["commonwords.txt", "specialwords.txt"] for file_name in files: attachment = open("Send_Email/"+ file_name, 'rb') base = MIMEBase("application", 'octet-stream') base.set_payload(attachment.read()) encoders.encode_base64(base) base.add_header("Content-Disposition", f"attachment; filename = {file_name}") msg.attach(base) server = smtplib.SMTP("smtp.gmail.com",587) server.starttls() server.login(sender_email, password) text = msg.as_string() server.sendmail(sender_email, [receiver_email] + cc, text) server.quit() print("Email sent")
Leave a Comment