Open
Description
I have the following code snippet that works some of the time, but more often that not results in a traceback indicating KeyError: 'InvalidFromAddress'
I am using python 3.10
def __notifySend(self, to_email: str, from_email: str) -> None:
msg = BasicMessage()
slc = SocketLabsClient(
int(str(os.getenv("SOCKETLABS_SERVER_ID"))),
str(os.getenv("SOCKETLABS_API_KEY"))
)
msg.subject = "Suspected troll found!"
msg.html_body = "<html>Busted!</html>"
msg.plain_text_body = "We got 'im boys!"
msg.from_email_address = EmailAddress(from_email)
msg.to_email_address.append(EmailAddress(to_email))
response = slc.send(msg)
print(response)
return
I am not sure why this would be the case, as the method more or less follows exactly what the documentation suggests, and sometimes it works as expected. I have tested this on two separate known-good email addresses and can confirm that when the code does what it is supposed to, they appear in my inbox as expected.
Metadata
Metadata
Assignees
Labels
No labels