Error with gmail account
raise SMTPAuthenticationError(code, resp) smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials r22sm816511wmh.2 - gsmtp')
It sounds like your username or password are incorrect. Can you tell me any more details about what you're seeing?
My username and password are not incorrect, I'll provide you with more details!
Traceback (most recent call last):
File "C:\Users\Kafka\Desktop\send.py", line 2, in <module>
client = shawk.Client('[email protected]', 'genericemail')
File "C:\Users\Kafka\AppData\Local\Programs\Python\Python36\lib\site-packages\shawk\Client.py", line 49, in __init__
self.setup_inbox(pwd, auto=self.auto_refresh_enabled)
File "C:\Users\Kafka\AppData\Local\Programs\Python\Python36\lib\site-packages\shawk\Client.py", line 171, in setup_inbox
self.enable_auto_refresh()
File "C:\Users\Kafka\AppData\Local\Programs\Python\Python36\lib\site-packages\shawk\Client.py", line 184, in enable_auto_refresh
self.auto_refresh()
File "C:\Users\Kafka\AppData\Local\Programs\Python\Python36\lib\site-packages\shawk\Client.py", line 196, in auto_refresh
self.refresh()
File "C:\Users\Kafka\AppData\Local\Programs\Python\Python36\lib\site-packages\shawk\Client.py", line 219, in refresh
obj['BODY'] = value.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xea in position 725: invalid continuation byte
>>>
Thank You, Andrej
So full disclosure I haven't touched this code in about two years now, but this is what looks like is going on -
https://github.com/hawkins/Shawk/blob/master/shawk/Client.py#L275
# Convert messages to string format and simplify structure
messages = []
for uid in raw_msgs:
obj = {}
obj['UID'] = uid
for key, value in raw_msgs[uid].items():
try:
if key.decode('utf-8') == 'BODY[HEADER.FIELDS (FROM)]':
obj['FROM'] = email.utils.parseaddr(value.decode('utf-8'))[1]
else:
if key.decode('utf-8') == 'BODY[TEXT]':
obj['BODY'] = value.decode('utf-8') # <--- your error here
else:
obj[key.decode('utf-8')] = value.decode('utf-8')
except AttributeError:
obj[key.decode('utf-8')] = value
messages.append(obj)
It looks like we're trying to decode your email, but its body isn't UTF-8 encoded. I'm not familiar enough with typesets to know what values you might be sending to encounter this, though. Can you give me a sample text you tried to receive?
Regardless, that's definitely a different error from the first one you shared in this issue 🤔 did you get further this time around?
Thank you, I'll try this when I get home! Strange I did not change the code at all, I'll have a look into that! Thanks again, Andrej Hatzi