Mailgun Email Error : Extra Data

Mailgun Showing Error

To resolve this issue, first, check your API request and ensure that all required parameters are included and formatted correctly. Make sure that the payload is properly formatted as JSON and does not contain any extra data that is not recognized by the server.

Let us know if your query resolved

1 Like

Bellow is my code could you please tell me where is the problem. I couldn’t recognized the problem…

Can you share the code so we can assist you.

**Bellow is my code**
:face_holding_back_tears: :face_holding_back_tears:

import email_conf
from boltiot import Email, Bolt
import json, time

min= 300
max= 600

mybolt Bolt (email_conf.API_KEY, email_conf.DEVICE_ID)
mailer Email(email_conf.MAILGUN_API_KEY, email_conf. SANDBOX_URL, email_conf.SENDER_EMAIL, email_conf.RECIPIENT_EMAIL)

while True:
print (“Reading Sensor Value”)
response= mybolt.analogRead(‘A0’)
data= json. loads (response)
print ("Sensor value is "+str(data[‘value’]))
if sensor_value>max or sensor_value <min:
print(“Making request to Mailgun to send email”)
response-mailer.send_email(“Alert”, "The current temperature is "+str(temperature))
response_text = json. loads (response.text)
print ("Response recived from Mailgun is "+str(response_text [‘message’]))
except Exception as e:
print(“Error occured bellow are the detailes”)
print (e)

The code is encountering multiple errors, some of which are:

Typographical errors:

Incorrect usage of quotes: The quotes used in the code are not standard quotes, which are causing a syntax error. Use either single quotes (’ ') or double quotes (" ") instead of the quotes used in the code.
Incorrect use of equals sign: The equals sign = is being used instead of the minus sign - in the following line: response-mailer.send_email(“Alert”, "The current temperature is "+str(temperature)).
Naming errors:

Incorrect class instantiation: The class instantiation for Bolt and Email is missing the = sign. Use mybolt = Bolt(email_conf.API_KEY, email_conf.DEVICE_ID) and mailer = Email(email_conf.MAILGUN_API_KEY, email_conf.SANDBOX_URL, email_conf.SENDER_EMAIL, email_conf.RECIPIENT_EMAIL).

Incorrect variable names: The variable name min shadows the built-in function min(), which is not recommended. Rename the variable to a more meaningful name, like min_value.
Incorrect mathematical operation:

The multiplication operator * is being represented as the letter x, causing a syntax error. Change 100xsensor_value to 100 * sensor_value.

1 Like

I changed accordingly but problem is not solved

I am facing the same problem , so i used vs code in windows to install bolt python library on my desktop and copied the exact same code from the tutorial, but still with that code too the error remains the same.

There is an error in the code.

In line 8, there is a syntax error because of the space between the function name mybolt and the parentheses. The line should be mybolt = Bolt(email_conf.API_KEY, email_conf.DEVICE_ID).

In line 15, the multiplication operator x is used instead of * in the calculation of the temperature. The line should be temperature = (100 * sensor_value) / 1024.

In line 17, the response variable is used instead of response_mailer to call the send_email method. The line should be response_mailer = mailer.send_email(“Alert”, "The current temperature is " + str(temperature)).

Do try this , do let us know if it helps you