BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Multiple E-mail with blynk:

i wanat to add more than one E-mail with my code for flame sensor when fire detect by sensor send E-mail to two email, how can i do this?

Are you using blynk legacy or blynk 2.0 ?

im using blynk legacy.

Add a second email command, immediately after your first, with a different email address.

Pete.

i did but it wasnt successed

could you send an example in both (blynk legacy and blynk 2.0)?

There’s a limit of one email ever 5 seconds, so you probably need to use a lambda timeout timer with the second email inside the lambda function.

They are totally different when it comes to messaging. examples are in the documentation.

Pete.

where can i find the documentation of lambda?

In the Timeout Timers section of this post…

Pete.

Check this out.

here is my code


// below link expliand  code for relay
// https://roboindia.com/tutorials/blynk-board-home-automation/


#define BLYNK_PRINT Serial
#include <LiquidCrystal_I2C.h>      // Library for LCD
#include <DHT.h>                    // Library for DHT11 sensor
#include <ESP8266WiFi.h>            // library for ESP8266
#include <BlynkSimpleEsp8266.h>     // library for blynk
LiquidCrystal_I2C lcd = LiquidCrystal_I2C (0x27,20,4);

char auth[] = "qkrI2FgTPb8FNukZY2lRe4ytftf29vwj";      // Auth Token of your projrct send by Blynk App to E-mail.
char ssid[] = "ARAZ";                                  // SSID of your network
char pass[] = "Arez and Avand";                        // Password of your network



//*****************Flame Sensor *****************************************
int flameButton = 1;            // to turn system ON/OFF by button on blynk app
#define flamesensor D0         // conect out of flame sensor to PIN D0 of NodeMCU




//************* Flame Sensor ***************
BLYNK_WRITE(V5) {
  flameButton = param.asInt();
}

void flamenotification() {
  int sensorfire = digitalRead(flamesensor);
      lcd.setCursor (0,3);
      lcd.print("Fire:");

  if (flameButton == 1) {
      Serial.println("flame sub-system is ON");
      delay(2000);
      if (sensorfire == 1) 
      {
      Serial.println("No Fire Detected by flame sensor");
      delay(2000);
      lcd.setCursor (5,3);
      lcd.print("Not Detected");
      } 
    else if (sensorfire == 0) 
    {
      Blynk.notify("Alert Message! fire is detected by flame sensor");
      Blynk.email("firat E-mail","fire Sensor Alert Message","WARNING!! Fire is Detected by flame sensor");
      timer.setTimeout(16000L, []() {
      Blynk.email("Second E-mail","fire Sensor Alert Message","WARNING!! Fire is Detected by flame sensor");
  });
       
 
 /*  *********************************/
      Serial.println("fire is detect by flame sensor");
      delay(2000);
      lcd.setCursor (5,3);
      lcd.print("Detected    ");
      delay(5000);
      
    }
    
  } 
  else if (flameButton == 0) 
    {
      Serial.println("flame Sub-system is OFF");
      delay(2000);

    }
}


void setup()
{
  lcd.init();
  lcd.backlight();
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);

//******** Flame Sensor *******
  pinMode(flameButton, INPUT);
  Serial.println("Start to detect fire by Flame sensor");
  delay(2000);
  timer.setInterval(1000L, flamenotification);
   timer.setTimeout(5000L, flamenotification);
}



void loop()
{
  Blynk.run();           //Initialize blynk
  timer.run();           //Initialize timer to send data 


}




i have tried one more times but it wasnt work

could you clarify it more in an example code to be explain more

thanks for your help

You can send email to your account then forward it automatically to multiple accounts.

https://support.google.com/mail/answer/10957?hl=en

@farhadgravi 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 correctly.
Triple backticks look like this:
```

Pete.

here is my code


// below link expliand  code for relay
// https://roboindia.com/tutorials/blynk-board-home-automation/


#define BLYNK_PRINT Serial
#include <LiquidCrystal_I2C.h>      // Library for LCD
#include <DHT.h>                    // Library for DHT11 sensor
#include <ESP8266WiFi.h>            // library for ESP8266
#include <BlynkSimpleEsp8266.h>     // library for blynk
LiquidCrystal_I2C lcd = LiquidCrystal_I2C (0x27,20,4);

char auth[] = "qkrI2FgTPb8FNukZY2lRe4ytftf29vwj";      // Auth Token of your projrct send by Blynk App to E-mail.
char ssid[] = "ARAZ";                                  // SSID of your network
char pass[] = "Arez and Avand";                        // Password of your network



//*****************Flame Sensor *****************************************
int flameButton = 1;            // to turn system ON/OFF by button on blynk app
#define flamesensor D0         // conect out of flame sensor to PIN D0 of NodeMCU




//************* Flame Sensor ***************
BLYNK_WRITE(V5) {
  flameButton = param.asInt();
}

void flamenotification() {
  int sensorfire = digitalRead(flamesensor);
      lcd.setCursor (0,3);
      lcd.print("Fire:");

  if (flameButton == 1) {
      Serial.println("flame sub-system is ON");
      delay(2000);
      if (sensorfire == 1) 
      {
      Serial.println("No Fire Detected by flame sensor");
      delay(2000);
      lcd.setCursor (5,3);
      lcd.print("Not Detected");
      } 
    else if (sensorfire == 0) 
    {
      Blynk.notify("Alert Message! fire is detected by flame sensor");
      Blynk.email("firat E-mail","fire Sensor Alert Message","WARNING!! Fire is Detected by flame sensor");
      timer.setTimeout(16000L, []() {
      Blynk.email("Second E-mail","fire Sensor Alert Message","WARNING!! Fire is Detected by flame sensor");
  });
       
 
 /*  *********************************/
      Serial.println("fire is detect by flame sensor");
      delay(2000);
      lcd.setCursor (5,3);
      lcd.print("Detected    ");
      delay(5000);
      
    }
    
  } 
  else if (flameButton == 0) 
    {
      Serial.println("flame Sub-system is OFF");
      delay(2000);

    }
}


void setup()
{
  lcd.init();
  lcd.backlight();
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);

//******** Flame Sensor *******
  pinMode(flameButton, INPUT);
  Serial.println("Start to detect fire by Flame sensor");
  delay(2000);
  timer.setInterval(1000L, flamenotification);
   timer.setTimeout(5000L, flamenotification);
}



void loop()
{
  Blynk.run();           //Initialize blynk
  timer.run();           //Initialize timer to send data 


}




 

i have used that way but i wanna use it in my coding

thanks

You need to remove those delays.

Pete.

you mean 16000 [timer.setTimeout(16000L, ], just remove it without doing anything else?

Thnaks

No, the lines that say delay(xxxx)

Pete.

I have removed the all delays but it still same

#define BLYNK_PRINT Serial
#include <LiquidCrystal_I2C.h>      // Library for LCD
#include <DHT.h>                    // Library for DHT11 sensor
#include <ESP8266WiFi.h>            // library for ESP8266
#include <BlynkSimpleEsp8266.h>     // library for blynk
LiquidCrystal_I2C lcd = LiquidCrystal_I2C (0x27,20,4);

char auth[] = "qkrI2FgTPb8FNukZY2lRe4ytftf29vwj";      // Auth Token of your projrct send by Blynk App to E-mail.
char ssid[] = "ARAZ";                                  // SSID of your network
char pass[] = "Arez and Avand";                        // Password of your network


BlynkTimer timer;
//*****************Flame Sensor *****************************************
int flameButton = 1;            // to turn system ON/OFF by button on blynk app
#define flamesensor D0         // conect out of flame sensor to PIN D0 of NodeMCU




//************* Flame Sensor ***************
BLYNK_WRITE(V5) {
  flameButton = param.asInt();
}

void flamenotification() {
  int sensorfire = digitalRead(flamesensor);
      lcd.setCursor (0,3);
      lcd.print("Fire:");

  if (flameButton == 1) {
      Serial.println("flame sub-system is ON");
     
      if (sensorfire == 1) 
      {
      Serial.println("No Fire Detected by flame sensor");
    
      lcd.setCursor (5,3);
      lcd.print("Not Detected");
      } 
    else if (sensorfire == 0) 
    {
      Blynk.notify("Alert Message! fire is detected by flame sensor");
      Blynk.email("farhadgravi@gmail.com","fire Sensor Alert Message","WARNING!! Fire is Detected by flame sensor");
      timer.setTimeout(10000L, []() {
      Blynk.email("farhad.mohammed@gmail.com","fire Sensor Alert Message","WARNING!! Fire is Detected by flame sensor");
  });
       
 
 /*  *********************************/
      Serial.println("fire is detect by flame sensor");
   
      lcd.setCursor (5,3);
      lcd.print("Detected    ");
  
      
    }
    
  } 
  else if (flameButton == 0) 
    {
      Serial.println("flame Sub-system is OFF");
     

    }
}


void setup()
{
  lcd.init();
  lcd.backlight();
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);

//******** Flame Sensor *******
  pinMode(flameButton, INPUT);
  Serial.println("Start to detect fire by Flame sensor");

   timer.setInterval(1000L, flamenotification);
   timer.setTimeout(5000L, flamenotification);
}



void loop()
{
  Blynk.run();           //Initialize blynk
  timer.run();           //Initialize timer to send data 


}