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

Multiple E-mail with blynk:

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 


}


What happens if you swap the email addresses around, or send another email to the first emaill address 10 seconds later?

Pete.

Try something like this :

void emailSend()
{
  Blynk.email("my_email@example.com", "Subject", "Your message goes here");  // Email 1
  timer.setTimeout(16000L, emailTwo);
  timer.setTimeout(32000L, emailThree);
  timer.setTimeout(46000L, emailFour);
}

void emailTwo() {
Blynk.email("my_email@example.com", "Subject", "Your message goes here");  // Email 2
}

void emailThree() {
Blynk.email("my_email@example.com", "Subject", "Your message goes here");  // Email 3
}

void emailFour() {
Blynk.email("my_email@example.com", "Subject", "Your message goes here");  // Email 4
}

i have test that one but for second email no emails has been sent, could you please modify my code with that last function you shared ?

thanks

i was swaped both emails, but no email recieved by both emaiil addreses.