I'm having the user input their email address. However, I'm assuming Python isn't recognizing the special character "@" but I'm not sure how recode/have the user input recognize that special character as part of the string.
import smtplib
sender_email = "kingofeverything@test.com"
rec_email = input('Enter a email to send to: ')
password = "Password"
SUBJECT = "Subject Line Test"
TEXT = "Test Text"
message = 'Subject: {}\n\n{}'.format(SUBJECT, TEXT)
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(sender_email, password)
print("Login success")
server.sendmail(sender_email, rec_email, message)
print("Email has been ent to ", rec_email)
server.quit()
How do I correct this?
#Error: using kingofeverything@gmail.com as my input
Traceback (most recent call last):
File "testss.gyp", line 4, in <module>
rec_email = input('Enter a email to send to: ')
File "<string>", line 1
kingofeverything@gmail.com
^
SyntaxError: invalid syntax