Reputation: 55
I can't find an email app that I like, so I decided to make my own. I'm using smtplib and python to do so. In the basic email file, I'm trying to let the user input the address they want to send to. The first issue is that it won't accept the '@' sign, saying it's invalid syntax. To get around this I put an underscore instead of the @ sign and However, it started saying the entire email address is undefined. What I think is messing it up is the '.com' at the end. I attached the error message. If anyone knows how to fix this please let me know.
Nats-Air:~ nattaylor$ python
/Users/nattaylor/Programming/Email/plainEmail.py
Reciever: nathanielptaylor_gmail.com
Traceback (most recent call last):
File
"/Users/nattaylor/Programming/Email/plainEmail.py",
line 8, in <module>
toaddress = input('Reciever: ')
File "<string>", line 1, in <module>
NameError: name 'nathanielptaylor_gmail' is not defined
Upvotes: 0
Views: 1273
Reputation: 55
I used raw_input on all the inputs instead of regular input, and that worked.
Upvotes: 0
Reputation: 57470
In Python 2, the input()
function tries to evaluate the user's input as though it were a Python expression. This is rarely a good idea. Use raw_input()
instead to just get a string from the user.
Upvotes: 2