ESP8266 Email Problems

Hello i’m trying to make a simple esp8266 program to detect water I’ve tried basing it off of the email code but the device drops the WiFi connection before it can send the email.

Here is my code

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "8f5fc55b2cc24**-/*/-/-/*/-*/58bc8";

void setup()
{
 Serial.begin(9600);
 Blynk.begin(auth, "Blue*****", "some*****");
}

void loop()
{
 Blynk.run(); 
 
  int iswaterdetected = !digitalRead(4);
 if(iswaterdetected){
   BLYNK_LOG("Water Detected");
   Blynk.email("8******11@vtext.com", "No Title", "alert water detected");
   
 }
 
}

please help!!

1 Like

If the water continues to trigger it will it continue to send emails?

every minute, yes :slight_smile: Unless you implement some logic.
It’s a good point, we’ll think about how to enhance it.

when the sensor is activated it shows on the serial port that it is triggered but doesn’t send a email, by the way thanks so much for helping me

Are you on iOS or Android?

im using android______________

Do you have email widget installed in the app?
Is your project active? (PLAY button is pressed)

yes I have installed the email widget and the app is active
its also continuing to drop connection to the server and i know its not the wifi because i have another steadily connected

this is the serial port it keeps repeating this

[324934] Connecting to cloud.blynk.cc:8442
[325120] Water Detected
[325223] Ready (ping: 103ms).
[325224] Water Detected
[325288] Water Detected
[325353] Water Detected
[325418] Water Detected
[325483] Water Detected
[325651] Water Detected
[325715] Water Detected
[325780] Water Detected
[325843] Water Detected
[325912] Water Detected
[325977] Water Detected
[326042] Water Detected
[326107] Water Detected
[326171] Water Detected
[326236] Water Detected
[326301] Water Detected
[326366] Water Detected
[326431] Water Detected
[326496] Water Detected
[326563] Water Detected
[326731] Water Detected
[326797] Water Detected
[326861] Water Detected
[326926] Water Detected
[326990] Water Detected

and the sensor isn’t activated

You are creating a flood error - that’s why you are getting disconnected.
Please use timers in order to use this functionality.

1 Like

I’m a true beginner also only 14, how would i fix this?

Take a look at this project:

Looks like this is very close to what you need.

You’ll need to install SimpleTimer library. I recommend you download the latest Blynk package - it has this library included : Releases · blynkkk/blynk-library · GitHub

When you send lot’s of messages, we disconnect you. So you need to decrease the amount of messages, by sending them, for example one each second. This is what Simple Timer does for you.

I just checked the email widget on Android - everything works perfectly.

1 Like

I’ve a similar project. The android app must being connected to server and only in this case the email will sent. I don’t know is it right.

No. It is not. Why do you think so?