Hi all,
I would like to send an email from my Gmail account using python so when i have an error ill receive an auto email. At current the program handles the errors internally and keeps trying to do its task. That part is fine but when it hits an error I would like to receive an email. So i did some googling and found this nice script
but i get an error
So I have checked the Lib folder and Smtplib.py is there and so is the email folder and the utils.py file.
Can anyone help ?
Cheers Shane
P.s using winblows
I would like to send an email from my Gmail account using python so when i have an error ill receive an auto email. At current the program handles the errors internally and keeps trying to do its task. That part is fine but when it hits an error I would like to receive an email. So i did some googling and found this nice script
Code:
import smtplib fromaddr = 'my email' toaddrs = 'to my email' msg = 'Test Email message' #provide gmail user name and password username = 'username' password = 'password' # functions to send an email server = smtplib.SMTP('smtp.googlemail.com:465') server.ehlo() server.starttls() server.ehlo() server.login(username,password) server.sendmail(fromaddr, toaddrs, msg) server.quit()
Code:
Traceback (most recent call last): File "C:\email.py", line 1, in <module> import smtplib File "C:\Python27\lib\smtplib.py", line 46, in <module> import email.utils File "C:\email.py", line 11, in <module> server = smtplib.SMTP('smtp.googlemail.com:465') AttributeError: 'module' object has no attribute 'SMTP'
Can anyone help ?
Cheers Shane
P.s using winblows
Comment