My code:
import smtplib
try:
mail = smtplib.SMTP('smtp.gmail.com', 587)
print("Connection successful")
except:
print("Connection failed")
content = str(input("Your message: "))
senderLogin = str(input('Your full email (currently only GMail): '))
senderPass = str(input('Your password(data is not stored): '))
receiverAcc = str(input('Who would you like to send it to: '))
mail.ehlo()
mail.starttls()
mail.ehlo
mail.login(senderLogin, senderPass)
try:
mail.sendmail(senderLogin, receiverAcc, content)
print ("Email sent")
except:
print('error')
mail.close()
I cannot get it to work. All that happens is that the shell pops up and it is a blank screen. Nothing else. If anyone can clarify and/or help, that would be great. Also, I have already enabled the lower-security apps in my google account.
UPDATE
I played around with the ports and found out that port 25 for smtp.gmail.com works.