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

Blynk.mail() Problem in 1.0.0-beta.3

When using Library Version 1.0.0-beta.3, not all of the Blink.email() arguments are being sent to the Blynk Cloud Server. With #define BLYNK_DEBUG enabled, I see that the only argument that is being sent is the mail Message argument. The mail Address Override argument and the mail Header argument are not being sent.

Whenever I revert back to using Library Version 0.6.1, without changing anything at all in my code, all three of the Blynk.mail() arguments are being sent to the Blynk Cloud Server. However the Blynk.mail() Address Override argument that I am sending continues to be ignored - all of the emails that I send are going to my default Blynk email address, not to the intended email address. So, I am unable to send any emails to anyone else while I am using Library Version 0.6.1. (I do see a “W” prefixing the email Address argument that I am sending - I don’t know if that should be there or not).

I am using NodeMCU ESP8266 hardware - I have used two different NodeMCU hardware versions - the problem is consistent across both board versions.

Joe Nelis
Pittsburgh PA

As far as I’m concerned, you shouldn’t be using the beta libraries unless it’s for compiling code that will be used with the Blynk 2.0 (Edgent) testing program.

Are you using local or cloud server? If local, what version?

Pete.

As stated in my report, I’m using the Cloud Server.

My Arduino IDE updated my Blynk Library version whenever I was doing an Update of all my various Libraries. I did not realize that there were restriction on using a beta version. Just trying to provide some useful feedback… My Bad. I will stick with using 0.6.1 in spite of its shortcoming with the mail feature.

Joe Nelis

Can you post a snippet of your code that’s sending the email (obscuring the actual email address that you’re using, but keeping the exact syntax).

Pete.

Here is the code that relevant to my emails :


// allow longer email messages (put this before including Blynk library)
#define BLYNK_PRINT Serial      // Comment this out to disable prints and save space
#define BLYNK_DEBUG             // Comment this out for production code 
#define BLYNK_MAX_SENDBYTES 256
#define BLYNK_MAX_READBYTES 256
#include <ESP8266WiFi.h>
#include <Blynk.h>
#include <BlynkSimpleEsp8266.h>
. . . . . 
. . . . . 

/* Globals */
char mailAddress[] = "xxxxx.xxxxx@gmail.com";
char mailHeader[] = "WARNING - Dining Room Plant Water Low";
char genericMailMessage[] = "Low Moisture";
char loggedOnMessage[] = "DR Plant Monitoring is Active";
char mailMessage[256];

. . . . 
. . . . 

void sendAlert()
{

  // We inverted the Moisture Level so that a Lower Number means Lower Moisture in Soil
  if( moistureLevel < alertLevel )
  {
    // next line for debug only
    Serial.println("Sent Low Dining Room Plant Moisture Level email to xxxxx.xxxxxx@gmail.com");
    
    sprintf(mailMessage, "DR Plant Moisture Level is %d (BELOW %d Setpoint)\n", moistureLevel, alertLevel);
    Blynk.email(mailAddress, mailHeader, mailMessage);

  } else {

    // next line for debug only
    Serial.println("Moisture Level OK - eMail Message is Not Required");
      
  }
}

. . . . . 
. . . . .

void setup() 
{
  Serial.begin(9600);             // open serial port (Comment out to eliminate all debug messages)
  Blynk.begin(auth, ssid, pass);  // initialize Blynk

  // Send e-mail when your hardware gets connected to Blynk Server
  // Just put the recepient's "e-mail address", "Subject" and the "message body"
  Blynk.email(mailAddress, mailHeader, loggedOnMessage);

. . . . .
. . . . . 
}

sendAlert() gets called by a 60 minute timer.

Joe Nelis

Have you tested the simple approach:

Blynk.email("your_email@mail.com", "Subject: Hello", "Hello");

Pete.

Yes, I did it using just simple character strings like that. I tried all kinds of variations. The ‘is active’ message in my setup() was initially done like your example before I optimized to use the predefined character array variables. (But I did not put "Subject: " in there because that was the subject argument.)

Once a Microsoft Windows update completes on the computer at my Blynk Client, I will change back to 1.0.0.3-beta and I will post what my Bylnk Client is sending to the Cloud Server. And I will post what is being sent whenever I’m using 0.6.1.

Keep in mind that the exact code that I shared works with Blynk Library 0.6.1 without any changes. With 0.6.1, I get email messages. The only problem with 0.6.1 is that the Cloud Server always sends all emails to my default Blynk Account email address. It never sends them to the different recipient that I have put into my code. The Cloud Serverr is ignoring the first argument. The documentation says any different email address that I put into my code and send to the Cloud Server will override my default Blynk Account email address. It doesn’t.

Joe Nelis

Debug Output with 1.0.0-beta3 Library :

11:10:28.004 -> [8102] Connected to WiFi
11:10:28.052 -> [8102] IP: 192.168.1.109
11:10:28.052 -> [8102] 
11:10:28.097 ->     ___  __          __
11:10:28.097 ->    / _ )/ /_ _____  / /__
11:10:28.144 ->   / _  / / // / _ \/  '_/
11:10:28.144 ->  /____/_/\_, /_//_/_/\_\
11:10:28.191 ->         /___/ v1.0.0-beta.3 on NodeMCU
11:10:28.238 -> 
11:10:28.238 -> [8186] Connecting to blynk-cloud.com:80
11:10:28.285 -> [8282] <[1D|00|01|00] hgvoX43ndeRfQ6o-0-Lru4XoxF-b21gB
11:10:28.331 -> [8321] >[00|00|01|00|C8]
11:10:28.378 -> [8321] Ready (ping: 34ms).
11:10:28.378 -> [8344] Free RAM: 48472
11:10:28.425 -> [8388] <[11|00|02|00]Nver[00]1.0.0-beta.3[00]h-beat[00]45[00]buff-in[00]256[00]dev[00]NodeMCU[00]build[00]May  1 2021 11:09:15[00]
11:10:28.566 -> [8507] <@[00|03|00]$notify[00]DR Plant Monitoring is Active
11:10:28.613 -> [8604] >[00|00|02|00|C8]
11:11:13.494 -> [53571] <[06|00|04|00|00]
11:11:13.541 -> [53603] >[00|00|04|00|C8]

Being sent as a Notify , not an email perhaps ??

Debug Output with 0.6.1 Library (Same Code) :

11:03:06.682 -> [572] Connected to WiFi
11:03:06.729 -> [572] IP: 192.168.1.109
11:03:06.729 -> [572] 
11:03:06.729 ->     ___  __          __
11:03:06.776 ->    / _ )/ /_ _____  / /__
11:03:06.776 ->   / _  / / // / _ \/  '_/
11:03:06.823 ->  /____/_/\_, /_//_/_/\_\
11:03:06.870 ->         /___/ v0.6.1 on NodeMCU
11:03:06.870 -> 
11:03:06.870 -> [646] Connecting to blynk-cloud.com:80
11:03:06.917 -> [783] <[1D|00|01|00] hgvoX43ndeRfQ6o-0-Lru4XoxF-b21gB
11:03:06.964 -> [816] >[00|00|01|00|C8]
11:03:07.011 -> [816] Ready (ping: 32ms).
11:03:07.057 -> [816] Free RAM: 48456
11:03:07.057 -> [883] <[11|00|02|00]Gver[00]0.6.1[00]h-beat[00]10[00]buff-in[00]256[00]dev[00]NodeMCU[00]build[00]May  1 2021 11:00:17[00]
11:03:07.198 -> [987] >[00|00|02|00|C8]
11:03:07.245 -> [1020] <[0D|00|03|00]Wdesired.recipiant@gmail.com[00]WARNING - Dining Room Plant Water Low[00]DR Plant Monitoring is Active
11:03:08.672 -> [2551] >[00|00|03|00|C8]
11:03:17.204 -> [11102] <[06|00|04|00|00]

But goes to my default Blynk email address, not to “desired.recipiant@gmail.com

Joe Nelis

That’s a waste of time in my opinion. The new (beta) version of Blynk handles notifications, emails etc differently. Stick with 0.6.1

Have you tried deleting the email address that’s in the “To” field in the email app widget?

Pete.

Understand. I will stick with 0.6.1 and will not be concerned with the 1.0.0-beta versions. But, that sounds like it is going to break a lot of existing code that uses emails.

I have tried deleting the email address that was defaulted into the email widget in the app. It never did any good before. BUT retrying it right now, it worked as expected !!! My email went to the desired recipient. I guess I had something else that was wrong in my code whenever I had tried doing that before.

Sorry to have bothered you with this. Thank you for your time. You can close out this thread as Pilot Error, Not Relevant, or lock it - - whatever you do with dead threads.

Joe Nelis (with head hung low)

That’s just the tip of the iceberg!

Glad it’s working now. Sometimes there are just so many variable that you don’t try all of the various options in each scenario. Just focussing on one library version cuts all of that by half.

I’ll mark the topic as Solved, but you can still post to it in future if you need to.

Pete.