BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

Class blynkwifi has no menber name email

When I compile my code on arduino id shows this message…
Class blink wifi has no member named email. I have given my code below.

//Change Blynk Authenticaation Details
#define BLYNK_TEMPLATE_ID ""
#define BLYNK_DEVICE_NAME "Gas Detection Alert"
#define BLYNK_AUTH_TOKEN ""

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

 
char auth[] = BLYNK_AUTH_TOKEN;

char ssid[] = "";  // Enter your wifi name
char pass[] = "";  // Enter your wifi password
int smokeA0 = A0;
int data = 0;
int sensorThres = 100;


BlynkTimer timer;

void sendSensor(){
 
 int data = analogRead(smokeA0);
 Blynk.virtualWrite(V0, data);
  Serial.print("Pin A0: ");
  Serial.println(data);


  if(data > 999)     // Change the Trashold value
  {
    Blynk.email("", "Alert", "Gas Leakage Detected!");
    Blynk.logEvent("gas_alert","Gas Leakage Detected");
  }
}

void setup(){
  pinMode(smokeA0, INPUT);
   Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  //dht.begin();
  timer.setInterval(2500L, sendSensor);
}

void loop(){
  Blynk.run();
  timer.run();
}
```````````````````````````

@science Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Copy and paste these if you can’t find the correct symbol on your keyboard.

Pete.

You’ve made a pretty good job of revealing lots of sensitive information in one post to a public forum.

You’ve disclosed your Blynk template ID, Auth token, WiFi SSID and password and your email address!

As the error message says, the problem is with this line of code…

If you read the documentation it tells you that Blynk.email() is a legacy feature, and for IoT you need to…

Replace Blynk.notify(), Blynk.email(), Blynk.tweet(), Blynk.sms() with Blynk.logEvent(). Read this guide on how to set up Events with notifications.

https://docs.blynk.io/en/blynk-1.0-and-2.0-comparison/migrate-from-1.0-to-2.0#hardware-migration

You’re already using Blynk.logEvent(), so you actually need to delete the problematic line of code and change the way that your event and it’s notification tab are configured.

However, you have a flaw in the logic of your code which - under a prolonged period of the smoke detector reading being above your threshold - will result in you exceeding the 100 maximum logEvents per 24 hour period.

You should use a flag variable to avoid that happening. See this for more info…

Pete.