[SOLVED] Blynk.email() is not working, while Blynk.notify() works

Push notifications work but, emails doesn’t go through…
It used to work before a week, but stopped sending emails from 18th, April…

Note:-
Blynk App on mobile has both Push and Email widgets

I call the Alert() function with this code:

  if (rh >= HumidThreshold)
  {
    Alert("Humidity", 1, 4);
  }

I’ve set the Buzzer, Push and Email as HIGH…
When the Alert() is executed the Buzzer goes on, I get Push Notification, but I don’t get the email…

Here’s the Alert() code:-

void Alert(String Sensor, int AlertType, int LEDAlert)
{
  if (Buzzer == HIGH)
  {
  digitalWrite(buzzPin, HIGH); // Activate Buzzer
  }
  if (Push == HIGH)
  {
    if (AlertType == 1)
    {
//      Blynk.notify(Location + ": Emergency " + Sensor + " Alert!");   // Notification with Location First
      Blynk.notify("Emergency: " + Sensor + " Alert! @" + Location);  // Notification with Situation First
    }
  }
  if (Email == HIGH)
  {
    if (AlertType == 1)
    {
      Blynk.email("ilak2k@gmail.com", "Emergency: " + Sensor + " Alert! @" + Location, "This is a sensor-triggered alert, from Monitoring System! Investigate specified location");
    }
  }
  Blynk.virtualWrite(LEDAlert, 1023);  // Write HIGH to Virtual Pin 4
}

This used to work and now it doesn’t… What might be the issue here???

Hello. First of all - could you please add some tracing or debug info? In other words - are you sure Blynk.email is called? Most probably problem isBlynk.email is not called. Even it was working before.

@Dmitriy I’ve included debug info here for your reference… As I said, I keep getting Push Notification every minute. But no emails so far…

Blynk Debug:

Alert Code:

void Alert(char* Sensor, int AlertType, int LEDAlert)
{
  if (Buzzer)
  {
  digitalWrite(buzzPin, HIGH); // Activate Buzzer
  }
  if (AlertType == 1)
  {
    snprintf(szMsg, sizeof(szMsg), "Emergency: %s Alert! @%s", Sensor, Location);
  }
  else
  {
    snprintf(szMsg, sizeof(szMsg), "%s Surge Detected! @%s", Sensor, Location);
  }
  
  if (Push)
  {
    Serial.print("Sending Notification: ");
//    Serial.println(szMsg);
    Blynk.notify(szMsg);
    Serial.println("Sent Notification!");
  }

  if (Email)
  {
    Serial.print("Sending Email: ");
//    Serial.println(szMsg);
    Blynk.email("ilak2k@gmail.com", szMsg, "This is a sensor-triggered alert, from Monitoring System! Investigate specified location");
    Serial.println("Sent Email!");
  }
  Blynk.virtualWrite(LEDAlert, 1023);  // Write HIGH to Virtual Pin 3
}

@Dmitriy I’ve updated my reply with Serial Monitor Screenshot & Alert Code… Why is the email not getting sent? I assure you I’ve included Push Notification Widget & Email Widget…

@ilak2k perhaps you mean why isn’t the email being received rather than why isn’t is being sent as Serial Monitors confirms the message was sent.

There can be a host of reasons why an email is not received.

Maybe try a different address with a different service provider.

@Costas Also refer to this Debug Report here…
Disconnects everytime email is sent and i keep getting notifications every 10 seconds… Why would it disconnect while trying to send an email?

It doesn’t appear to disconnect every time as your previous Serial Monitor showed it was fine.

Have you tested with email subject of “Email test”?

@Dmitriy @Costas It works now! Looks like the length of the email I’m generating is more than the allowed limit…

    snprintf(szMsg, sizeof(szMsg), "Emergency: %s Alert! @%s", Sensor, Location);
    snprintf(szMsg, sizeof(szMsg), "%s Surge Detected! @%s", Sensor, Location);

That’s the subject we just created… And then…

Blynk.email("ilak2k@gmail.com", szMsg, "This is a sensor-triggered alert, from Monitoring System! Investigate specified location");

So, the message goes like this:
Subject:
Emergency: Temperature Alert! @Projector Cabin 456
Content:
This is a sensor-triggered alert, from Monitoring System! Investigate specified location

That’s an unbelievably small allowed limit for an Email Alert! You guys could increase the email interval to even 5 mins allow more length. An email alert every minute is insane! It helps for testing and stuff. But when it comes to actual usage, such frequent emails is not required…

@ilak2k Glad it is working. I think this is not Blynk limit…

@vshymanskyy do we have some limit here?

@Dmitriy It should be Blynk’s limit… I had to reduce length for my Arduino UNO R3 and Particle Photon… That’s 2 different devices and both don’t work for the full length of the message…
Refer to the attached email screenshot here… I assume, most of the length is taken by the subject… And it leaves me with too less for the content…

Server doesn’t have any length limit for email. So I believe this is something hardware specific or blynk library specific. @vshymanskyy should know better.

@Dmitriy If there’s no length limit for email, I’ll happily generate a report based on the event and include that with the email!

Hi. please see this comment [SOLVED] Blynk.email seems limited to 97 characters

@ilak2k, did it help?

Yes it did! I use an online bytes calculator… get the required memory in KB and I use it for the message to be handled. Solved! Thank you very much @vshymanskyy