Error in Email Sending

When I write the code:
response = mailer.send_email(“Stop Overcrowding”)
forum%20problm
The above error occurs.
Kindly help,
Regards
Tunir

1 Like

Hi
The code for sending the email is written as follows in the iot training:
response = mailer.send_email(“Alert”, "The Current temperature sensor value is " +str(sensor_value))
Check your code again and verify it with the one that of the training.
I think this error occurs, as that code requires two parts, the subject and The body for the email.
Thanks

@tunirkv19
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 that the body part is missing.
syntax: send_email(“subject of the mail”,“body of the mail”)
Example:
send_email(“Stop Overcrowding”," here you have to provide the mail body message either a string or numerical value")

2 Likes

@nazirahammed98 thanks for this!
Regards,
Tunir

1 Like