I have been experimenting with smptlib and am trying to sen a email to somebody. Here is my code:
import smtplib
my_email = "sender_email@gmail.com"
my_password = "password1234"
connection = smtplib.SMTP("smtp.gmail.com")
connection.starttls()
connection.login(user=my_email, password=my_password)
connection.sendmail(from_addr=my_email, to_addrs="receiver_email@gmail.com", msg="Hello")
connection.quit()
The sender's email, sender's password, and receiver's email are not valid, for privacy reasons. I do, however keep getting this error:
PermissionError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions
It may help you to know that I am using the latest version of PyCharm IDE and the latest version of smtplib. My question is: Why am I continually getting this error?
I tried fiddling around, and I think that the code:
connection = smtplib.SMTP("smpt.gmail.com")
was the problem. I think. I also have tried putting in examples and other people's code, but I get the same PermissionError
as always.