I am new to python. I found my python code return unreasonably return tab error:
msgs['to'] = "xxx@gmail.com"
^
TabError: inconsistent use of tabs and spaces in indentation
Here is part of my code:
def send_email(self):
try:
msgs = MIMEMultipart()
msgs['to'] = "xxx"
msgs['from'] = "xxx"
msgs['subject'] = "abc"
msgs.attach(MIMEText(file("~/att1.py").read())
msgs.attach(MIMEText(file("~/att2.docx").read())
server = smtplib.SMTP()
server.connect('smtp.gmail.com:587')
server.login('xxx','xxx')
server.sendmail(msgs['from'], msgs['to'],msgs.as_string())
server.quit()
print "Successfully sent email"
return True
except SMTPException:
print "Error: unable to send email"
print str(SMTPException)
return False