I am trying to implement a functionality in python where I want to send a file as an attachment to an email alert Everything works fine. i am getting the email alert with required subject but the only problem is that I get the same attachment twice in my email alert.
fileMsg = email.mime.base.MIMEBase('application','octet-stream')
fileMsg.set_payload(file('/home/bsingh/python_files/file_dict.txt').read())
#email.encoders.encode_base64(fileMsg)
fileMsg.add_header('Content-Disposition','attachment;filename=LogFile.txt')
emailMsg.attach(fileMsg)
# send email
server = smtplib.SMTP(smtp_server)
server.starttls()
server.login(username, password)
server.sendmail(from_add, to_addr,emailMsg.as_string())
server.quit()
There was an issue with the version..Has been resolved