Help me with email notification

I want my project only send a email notification when the status of the feeder is change base on fsr sensor, not looping. this is my code and I have trouble with email notification and delay on my apps when showing time. please help me


#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
#include <Servo.h>
int button;
int pos;
Servo servo;
const int FSR_PIN = A0;
const int LED_PIN3 = D4;
const float VCC = 4.98; // Measured voltage of Ardunio 5V line
const float R_DIV =2000.0; // Measured resistance of 3.3k resistor

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

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "------";
char pass[] = "---------";

BlynkTimer timer;
WidgetRTC rtc;

// Digital clock display of the time
void clockDisplay()
{
  // You can call hour(), minute(), ... at any time
  // Please see Time library examples for details

  String currentTime = String(hour()) + ":" + minute() + ":" + second();
  String currentDate = String(day()) + "-" + month() + "-" + year();
  Serial.print("Current time: ");
  Serial.print(currentTime);
  Serial.print(" ");
  Serial.print(currentDate);
  Serial.println();

  // Send time to the App
  Blynk.virtualWrite(V1, currentTime);
  // Send date to the App
  Blynk.virtualWrite(V2, currentDate);
}

void setup()
{
  // Debug console
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  Blynk.email("--------", "-----", "My Blynk project is online.");
  servo.attach(D8);
  pinMode(FSR_PIN, INPUT);
  pinMode(LED_PIN3, OUTPUT);
  
  
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "--------", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,43,25), 8080);

  // Begin synchronizing time
  rtc.begin();

  // Other Time library functions can be used, like:
  //   timeStatus(), setSyncInterval(interval)...
  

  // Display digital clock every 10 seconds
  timer.setInterval(1000L, clockDisplay);
}
BLYNK_WRITE(V4){
  button=param.asInt();
  }
void notificationOnemail(){
    Blynk.email("------", "food status", "food still exist");
    Serial.print("food still exist");
    delay (1000000);
}
  void notificationOffemail(){
    Blynk.email("-----------", "food status", food is empty");
    Serial.print("food status");
    delay (1000000);
}
void loop()
{
  {
  
  Blynk.run();
  if (button == 1){
    servo.write(pos);
    Blynk.email("----------", "food drop", "food is dropped");
    }
    else {
      servo.write(25);
      }
    timer.run();
}
  //FSR SENSOR
  // If the FSR has no pressure, the resistance will be
  // near infinite. So the voltage should be near 0.
int fsrADC = analogRead(FSR_PIN);
if (fsrADC != 0) // If the analog reading is non-zero
  {
    // Use ADC reading to calculate voltage:
    float fsrV = fsrADC * VCC / 1023.0;
    // Use voltage and static resistor value to 
    // calculate FSR resistance:
    float fsrR = R_DIV * (VCC / fsrV - 1.0);
    Serial.println("Resistance: " + String(fsrR) + " ohms");
    // Guesstimate force based on slopes in figure 3 of
    // FSR datasheet:
    float force;
    float fsrG = 1.0 / fsrR; // Calculate conductance
    // Break parabolic curve down into two linear slopes:
    if (fsrR <= 600)
    force = (((fsrG - 0.00075) / 0.00000032639)-0.50);
    else
      force =  ((fsrG / 0.000000642857)-0.50);
    Serial.println("Force: " + String(force) + " g");
    Serial.println();
    if(force>10)
    {
       digitalWrite(LED_PIN3,LOW);
       notificationOnemail();
       
       }
    
  }
  else
  {
     for (int i = 0; i < 80; i++) {  // make a sound
    digitalWrite(LED_PIN3, HIGH); // send high signal to buzzer 
    delay(1); // delay 1ms
    digitalWrite(LED_PIN3, LOW); // send low signal to buzzer
    delay(1);
  }
  delay(50);
  for (int j = 0; j < 100; j++) { //make another sound
    digitalWrite(LED_PIN3, HIGH);
    delay(2); // delay 2ms
    digitalWrite(LED_PIN3, LOW);
    delay(2);
    notificationOffemail();
  }
  
  
  
  delay(1000);
  }
  }

@Jose12 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:
```

Pete.

please help me

Before you do anything, you need to sort-out your void loop.

Pete.

you mean like this

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
#include <Servo.h>
int button;
int pos;
Servo servo;
const int FSR_PIN = A0;
const int LED_PIN3 = D4;
const float VCC = 4.98; // Measured voltage of Ardunio 5V line
const float R_DIV =2000.0; // Measured resistance of 3.3k resistor

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "MvVbQl3vve2D8yvkF0o5L3pSfAfu_YDu";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "MITO A33";
char pass[] = "2c74ff5cafeb";

BlynkTimer timer;
WidgetRTC rtc;

// Digital clock display of the time
void clockDisplay()
{
  // You can call hour(), minute(), ... at any time
  // Please see Time library examples for details

  String currentTime = String(hour()) + ":" + minute() + ":" + second();
  String currentDate = String(day()) + "-" + month() + "-" + year();
  Serial.print("Current time: ");
  Serial.print(currentTime);
  Serial.print(" ");
  Serial.print(currentDate);
  Serial.println();

  // Send time to the App
  Blynk.virtualWrite(V1, currentTime);
  // Send date to the App
  Blynk.virtualWrite(V2, currentDate);
}

void setup()
{
  // Debug console
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  Blynk.email("projekblynk54@gmail.com", "Perangkat Sudah Terhubung, Silahkan", "My Blynk project is online.");
  servo.attach(D8);
  pinMode(FSR_PIN, INPUT);
  pinMode(LED_PIN3, OUTPUT);
  
  
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,43,25), 8080);

  // Begin synchronizing time
  rtc.begin();

  // Other Time library functions can be used, like:
  //   timeStatus(), setSyncInterval(interval)...
  // Read more: http://www.pjrc.com/teensy/td_libs_Time.html

  // Display digital clock every 10 seconds
  timer.setInterval(1000L, clockDisplay);
}
BLYNK_WRITE(V3){
  button=param.asInt();
  Serial.println(param.asStr());
  }
/*void notifikasiOnemail(){
    Blynk.email("-------", "Status Pakan", "Pakan Masih Ada");
    Serial.print("Pakan Masih Ada");
    delay (1000000);
}
  void notifikasiOffemail(){
    Blynk.email("---------", "Status Pakan", "Pakan Sudah Habis");
    Serial.print("Pakan Sudah Habis");
    delay (1000000);
}
*/
void pakan(){
   if (button == 1){
    servo.write(pos);
    Blynk.email("----------", "Pemberian Pakan", "Pakan Telah Diberikan");
    }
    else {
      servo.write(25);
      }
      }
void loop()
{
  {
  
  Blynk.run();
  timer.run();
}

  // If the FSR has no pressure, the resistance will be
  // near infinite. So the voltage should be near 0.
int fsrADC = analogRead(FSR_PIN);
if (fsrADC != 0) // If the analog reading is non-zero
  {
    // Use ADC reading to calculate voltage:
    float fsrV = fsrADC * VCC / 1023.0;
    // Use voltage and static resistor value to 
    // calculate FSR resistance:
    float fsrR = R_DIV * (VCC / fsrV - 1.0);
    Serial.println("Resistance: " + String(fsrR) + " ohms");
    // Guesstimate force based on slopes in figure 3 of
    // FSR datasheet:
    float force;
    float fsrG = 1.0 / fsrR; // Calculate conductance
    // Break parabolic curve down into two linear slopes:
    if (fsrR <= 600)
    force = (((fsrG - 0.00075) / 0.00000032639)-0.50);
    else
      force =  ((fsrG / 0.000000642857)-0.50);
    Serial.println("Force: " + String(force) + " g");
    Serial.println();
    if(force>10)
    {
       digitalWrite(LED_PIN3,LOW);
       Blynk.email("---------", "Status Pakan", "Pakan Masih Ada");
       //notifikasiOnemail();
       
       }
    delay(1000);
  }
  else
  {
     for (int i = 0; i < 80; i++) {  // make a sound
    digitalWrite(LED_PIN3, HIGH); // send high signal to buzzer 
    delay(1); // delay 1ms
    digitalWrite(LED_PIN3, LOW); // send low signal to buzzer
    delay(1);
  }
  delay(50);
  for (int j = 0; j < 100; j++) { //make another sound
    digitalWrite(LED_PIN3, HIGH);
    delay(2); // delay 2ms
    digitalWrite(LED_PIN3, LOW);
    delay(2);
    Blynk.email("projekblynk54@gmail.com", "Status Pakan", "Pakan Masih Ada");
    //notifikasiOffemail();
  }
  
  
  
  delay(1000);
  }
  }

No!

Maybe if you clicked on the link I provided you would begin to understand.

Pete.

i am so sorry sir, English is my second language. can you guide me please where in my code i can edit.

here the code correct me if I wrong :

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
#include <Servo.h>
int button;
int pos;
Servo servo;
const int FSR_PIN = A0;
const int LED_PIN3 = D4;
const float VCC = 4.98; // Measured voltage of Ardunio 5V line
const float R_DIV =2000.0; // Measured resistance of 3.3k resistor

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "MvVbQl3vve2D8yvkF0o5L3pSfAfu_YDu";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "MITO A33";
char pass[] = "2c74ff5cafeb";

BlynkTimer timer;
WidgetRTC rtc;

// Digital clock display of the time
void clockDisplay()
{
  // You can call hour(), minute(), ... at any time
  // Please see Time library examples for details

  String currentTime = String(hour()) + ":" + minute() + ":" + second();
  String currentDate = String(day()) + "-" + month() + "-" + year();
  Serial.print("Current time: ");
  Serial.print(currentTime);
  Serial.print(" ");
  Serial.print(currentDate);
  Serial.println();

  // Send time to the App
  Blynk.virtualWrite(V1, currentTime);
  // Send date to the App
  Blynk.virtualWrite(V2, currentDate);
}

void setup()
{
  // Debug console
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  Blynk.email("projekblynk54@gmail.com", "Perangkat Sudah Terhubung, Silahkan", "My Blynk project is online.");
  servo.attach(D8);
  pinMode(FSR_PIN, INPUT);
  pinMode(LED_PIN3, OUTPUT);
  
  
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,43,25), 8080);

  // Begin synchronizing time
  rtc.begin();

  // Other Time library functions can be used, like:
  //   timeStatus(), setSyncInterval(interval)...
  // Read more: http://www.pjrc.com/teensy/td_libs_Time.html

  // Display digital clock every 10 seconds
  timer.setInterval(1000L, clockDisplay);
}
BLYNK_WRITE(V3){
  button=param.asInt();
  //Serial.println(param.asStr());
  }
/*void notifikasiOnemail(){
    Blynk.email("-", "Status Pakan", "Pakan Masih Ada");
    Serial.print("Pakan Masih Ada");
    delay (1000000);
}
  void notifikasiOffemail(){
    Blynk.email("-", "Status Pakan", "Pakan Sudah Habis");
    Serial.print("Pakan Sudah Habis");
    delay (1000000);
}
*/
void pakan(){
   if (button == 1){
    servo.write(pos);
    Blynk.email("-", "Pemberian Pakan", "Pakan Telah Diberikan");
    }
    else {
      servo.write(25);
      }
      }
      
  // If the FSR has no pressure, the resistance will be
  // near infinite. So the voltage should be near 0.
void beban(){
int fsrADC = analogRead(FSR_PIN);
if (fsrADC != 0) // If the analog reading is non-zero
  {
    // Use ADC reading to calculate voltage:
    float fsrV = fsrADC * VCC / 1023.0;
    // Use voltage and static resistor value to 
    // calculate FSR resistance:
    float fsrR = R_DIV * (VCC / fsrV - 1.0);
    Serial.println("Resistance: " + String(fsrR) + " ohms");
    // Guesstimate force based on slopes in figure 3 of
    // FSR datasheet:
    float force;
    float fsrG = 1.0 / fsrR; // Calculate conductance
    // Break parabolic curve down into two linear slopes:
    if (fsrR <= 600)
    force = (((fsrG - 0.00075) / 0.00000032639)-0.50);
    else
      force =  ((fsrG / 0.000000642857)-0.50);
    Serial.println("Force: " + String(force) + " g");
    Serial.println();
    if(force>10)
    {
       digitalWrite(LED_PIN3,LOW);
       Blynk.email("-", "Status Pakan", "Pakan Masih Ada");
       //notifikasiOnemail();
       
       }
    delay(1000);
  }
  else
  {
     for (int i = 0; i < 80; i++) {  // make a sound
    digitalWrite(LED_PIN3, HIGH); // send high signal to buzzer 
    delay(1); // delay 1ms
    digitalWrite(LED_PIN3, LOW); // send low signal to buzzer
    delay(1);
  }
  delay(50);
  for (int j = 0; j < 100; j++) { //make another sound
    digitalWrite(LED_PIN3, HIGH);
    delay(2); // delay 2ms
    digitalWrite(LED_PIN3, LOW);
    delay(2);
    Blynk.email("-", "Status Pakan", "Pakan Masih Ada");
    //notifikasiOffemail();
  }
  
  
  
  delay(1000);
  }
  }
  void loop()
  {  
  Blynk.run();
  timer.run();
}

i already clean my void loop but now it can read the sensor FSR value

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
#include <Servo.h>
int button;
int pos;
Servo servo;
const int FSR_PIN = A0;
const int LED_PIN3 = D4;
const float VCC = 4.98; // Measured voltage of Ardunio 5V line
const float R_DIV =2000.0; // Measured resistance of 3.3k resistor

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "MvVbQl3vve2D8yvkF0o5L3pSfAfu_YDu";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "MITO A33";
char pass[] = "2c74ff5cafeb";

BlynkTimer timer;
WidgetRTC rtc;

// Digital clock display of the time
void clockDisplay()
{
  // You can call hour(), minute(), ... at any time
  // Please see Time library examples for details

  String currentTime = String(hour()) + ":" + minute() + ":" + second();
  String currentDate = String(day()) + "-" + month() + "-" + year();
  Serial.print("Current time: ");
  Serial.print(currentTime);
  Serial.print(" ");
  Serial.print(currentDate);
  Serial.println();

  // Send time to the App
  Blynk.virtualWrite(V1, currentTime);
  // Send date to the App
  Blynk.virtualWrite(V2, currentDate);
}

void setup()
{
  // Debug console
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  Blynk.email("projekblynk54@gmail.com", "Perangkat Sudah Terhubung, Silahkan", "My Blynk project is online.");
  servo.attach(D8);
  pinMode(FSR_PIN, INPUT);
  pinMode(LED_PIN3, OUTPUT);
  
  
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,43,25), 8080);

  // Begin synchronizing time
  rtc.begin();

  // Other Time library functions can be used, like:
  //   timeStatus(), setSyncInterval(interval)...
  // Read more: http://www.pjrc.com/teensy/td_libs_Time.html

  // Display digital clock every 10 seconds
  timer.setInterval(1000L, clockDisplay);
}
BLYNK_WRITE(V3){
  button=param.asInt();
  //Serial.println(param.asStr());
  }
/*void notifikasiOnemail(){
    Blynk.email("-", "Status Pakan", "Pakan Masih Ada");
    Serial.print("Pakan Masih Ada");
    delay (1000000);
}
  void notifikasiOffemail(){
    Blynk.email("-", "Status Pakan", "Pakan Sudah Habis");
    Serial.print("Pakan Sudah Habis");
    delay (1000000);
}
*/
      
  // If the FSR has no pressure, the resistance will be
  // near infinite. So the voltage should be near 0.
void food(){
int fsrADC = analogRead(FSR_PIN);
if (fsrADC != 0) // If the analog reading is non-zero
  {
    // Use ADC reading to calculate voltage:
    float fsrV = fsrADC * VCC / 1023.0;
    // Use voltage and static resistor value to 
    // calculate FSR resistance:
    float fsrR = R_DIV * (VCC / fsrV - 1.0);
    Serial.println("Resistance: " + String(fsrR) + " ohms");
    // Guesstimate force based on slopes in figure 3 of
    // FSR datasheet:
    float force;
    float fsrG = 1.0 / fsrR; // Calculate conductance
    // Break parabolic curve down into two linear slopes:
    if (fsrR <= 600)
    force = (((fsrG - 0.00075) / 0.00000032639)-0.50);
    else
      force =  ((fsrG / 0.000000642857)-0.50);
    Serial.println("Force: " + String(force) + " g");
    Serial.println();
    if(force>10)
    {
       digitalWrite(LED_PIN3,LOW);
       Blynk.email("------", "Status Pakan", "Pakan Masih Ada");
       //notifikasiOnemail();
       
       }
    delay(1000);
  }
  else
  {
     for (int i = 0; i < 80; i++) {  // make a sound
    digitalWrite(LED_PIN3, HIGH); // send high signal to buzzer 
    delay(1); // delay 1ms
    digitalWrite(LED_PIN3, LOW); // send low signal to buzzer
    delay(1);
  }
  delay(50);
  for (int j = 0; j < 100; j++) { //make another sound
    digitalWrite(LED_PIN3, HIGH);
    delay(2); // delay 2ms
    digitalWrite(LED_PIN3, LOW);
    delay(2);
    Blynk.email("-----", "Status Pakan", "Pakan Masih Ada");
    //notifikasiOffemail();
  } 
  delay(1000);
  }
  }
  void loop(){
   Blynk.run();
   if (button == 1){
    servo.write(pos);
    Blynk.email("-----", "Pemberian Pakan", "Pakan Telah Diberikan");
    }
    else {
      servo.write(25);
      }
      timer.run();
      }

I can tell that you haven’t clicked the “Keep your void loop() clean” link yet, which is probably why you aren’t making any progress.

Click the link, translate the article into your own language, study what it says about calling functions with timers, not putting anything in your void loop other than the two essential lines of code, and then you might get somewhere.

Pete.