Error in mailgun code

error_email
I had check all space , spelling and code but still getting the error
help to slove it

@kahkeshan2299
send_email() takes 2 arguments. !st argument is the subject of the mail and the 2nd argument is the body of the mail which contains the information.
As you have passed only 1 argument that’s why you get an error.

Syntax:

send_email(“subject of the mail”,“body of the mail”)

subject of the mail - “Alert”, "The Current temperature sensor value is "
body of the mail - +str(sensor_value)
i m still getting the same error

@kahkeshan2299
provide the modified code and also check for any indentation error because it is very difficult to check the indentation error.


i had check indentation and also the email_conf data for number times but still getting the same error
thank you

did you check the url and mailgun api key

Did you the conf.py file and use the “test” word before the SANDBOX_URL

Hi @kahkeshan2299 you haven’t closed all the brackets in line 19. Give another round bracket at the end of that line.

2 Likes

Hi @kahkeshan2299
The error is in line 19 of your original image or line 22 of your new image.
You forgot to close the bracket for print statement.
Correct statement is as follows:
print ("Response received from Mailgun is : " + str(response_text))

I think now your program should work.
I’ll give you a suggestion too. From next time when you have to give indentations, try to use tab as they make the indentations clear.

2 Likes

thank you all
problem is sloved

2 Likes

I think u have to give proper indentation line by line. And also u have to put last statement time.sleep(10) in while loop.