I'm working on a program to log the work i do as well as email the monthly log. The problem i'm having is that every time i try to test out the smtp i get an error
`
Traceback (most recent call last):
File "C:/Users/palmer_a/Documents/App/testy.py", line 5, in <module>
import smtplib
File "C:\Python34\lib\smtplib.py", line 47, in <module>
import email.utils
File "C:\Python34\lib\email\utils.py", line 33, in <module>
from email._parseaddr import quote
File "C:\Python34\lib\email\_parseaddr.py", line 16, in <module>
import time, calendar
File "C:/Users/palmer_a/Documents/App\calendar.py", line 24, in <module>
class Calendar(ttk.Frame):
File "C:/Users/palmer_a/Documents/App\calendar.py", line 27, in Calendar
datetime = calendar.datetime.datetime
AttributeError: 'module' object has no attribute 'datetime'
This is the code i have for the email script
from tkinter import *
from tkinter import ttk
from datetime import date
import sqlite3
import smtplib
def email_log(self):
# Specifying the from and to addresses
self.fromaddr = 'remlaproductions@gmail.com'
self.toaddrs = 'draedarockstar@gmail.com'
self.subject = 'EMP Info'
# Writing the message (this message will appear in the email)
self.msg = EmailMessage()
self.msg['Subject'] = self.subject
self.msg['From'] = Address(self.fromaddr)
self.msg['To'] = (Address(self.toaddrs))
self.msg.set_content(""" {} """.format(search_log.self.tree.get_children()))
# Gmail Login
self.username = 'remlaproductions'
self.password = 'draedarockstar'
#Sending Email
try:
self.server = smtplib.SMTP('smtp.gmail.com',25)
self.server.smtp.ehlo()
self.server.starttls()
self.server.ehlo()
self.server.login(self.username,self.password)
self.server.sendmail(self.fromaddr, self.toaddrs, self.msg)
messagebox.showinfo(title = "Email Update", message = "Email Sent")
except:
messagebox.showinfo(title = "Email Update", message = "Error sending email")
self.server.quit()