The screenshot of my code. How do I resolve this?
The error screenshot
Head to this thread. All your possible solutions, you will find there.
Remove the the below line from your code
response_text = json.loads(response.text)
print("Response received from Mailgun is: " + str(response_text['message']))
and directly print the response without doing json.loads()
print ("Mailgun response is " + response.text)
Another method - Put this on the email part
response_email = mailer.send_email (āAlertā, " current temperature sensor value is: "+ str(data[āvalueā])
response_text = json.loads( response_email .text)
print("Response received from Mailgun is: " + str(response_text[āmessageā]))
Iām not receiving the mail. I followed the directions you said in the thread you mentioned but still not getting emails
while True:
print (āReading sensor valueā)
response = mybolt.analogRead(āA0ā)
data = json.loads(response)
print ("Sensor value is: " + str(data[āvalueā]))
try:
sensor_value = int(data[āvalueā])
if sensor_value > maximum_limit or sensor_value < minimum_limit:
print(āMaking request to Mailgun to send an emailā)
response = mailer.send_email(āAlertā, "The Current temperature sensor value is " +str(sensor_value))
print ("Mailgun response is " + response.text)
except Exception as e:
print (āError occured: Below are the detailsā)
print (e)
time.sleep(10)
CHANGE YOUR CODE WITH THIS AND YOUR ISSUE WILL BE SOLVED
this is my code but itās still not working
response = mailer.send_email(āAlertā, "The Current temperature sensor value is " +str(sensor_value))
print ("Mailgun response is " + response.text)
replace the above line with yours
this will directly print the response without doing json.loads()
Your code is working fine without any error right? Tell me about that first.
Yes the code is working
Ok great ! Have you verified your recipient email on mailgun.com?
I want you to stick with me here, I will help you through it as quickly as possible.
Yes I have verified my email
Recipient Email. Not asking about mailgun account. Go through this post, and check if you have VERIFIED your recipient mail.
Yes I have verified the email like that
Great. Check your spam/junk folder of your email.
Spam is empty and no new email
Does your mailgun dashboard look something like this?
0/0 delivererd ?
yes it looks like that
Run the code, fulfill the condition and send a screenshot here.