Thanks in advance for this.
I am unable to get either Blynk.email or Blynk.notify to work for me.
I am calling Blynk.email and Blynk.notify and see nothing. No emails. No notifications.
I DO get a Blynk notification with the device goes offline, just not when the ESP8266 calls Blynk.notify.
I have the Email and the Notify widgets both installed in my Blynk App.
Hope it’s an obvious (to you!) error…
Code
#define SKETCH_NAME "EMAIL DEMO"
#define SERIAL_SPEED 230400
// My Helper Files
#include "MY_WIFI_CREDENTIALS.h" // #defines MY_WIFI_SSID/2 AND MY_WIFI_PASSWORD/2
#include "MY_BLYNK_CREDENTIALS.h" // #defines MY_BLYNK_SERVER and MY_xxx_AUTHCODE
#define MY_BLYNK_AUTHCODE MY_DEMO_AUTHCODE
#define BLYNK_PRINT Serial // Generates Blynk debug prints.
#define BLYNK_DEBUG
#define EMAIL_ADDRESS "my.email@gmail.com"
#define EMAIL_SUBJECT "Test from Blynk"
#define EMAIL_BODY_SETUP "Test from setup()"
#define EMAIL_BODY_BUTTON "Test from Button push"
const char emailAddress[] = EMAIL_ADDRESS;
const char emailSubject[] = EMAIL_SUBJECT;
const char emailBodySet[] = EMAIL_BODY_SETUP;
const char emailBodyBut[] = EMAIL_BODY_BUTTON;
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// SETUP WIFI, BLYNK, and try one email
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void setup()
{
Serial.begin ( SERIAL_SPEED );
delay ( 500 );
Serial.println ( "\n\n=======================================" );
Serial.println ( SKETCH_NAME );
Serial.println ( "\n\n=======================================" );
Blynk.begin ( MY_BLYNK_AUTHCODE, MY_WIFI_SSID, MY_WIFI_PASSWORD );
Serial.println ( "From setup(). Sending email.\n" );
//Blynk.email ( EMAIL_ADDRESS, EMAIL_SUBJECT, EMAIL_BODY_SETUP );
//Blynk.email ( "my.email@gmail.com", "Hello", "Body" );
Blynk.email ( emailAddress, emailSubject, emailBodySet );
//Blynk.notify ( emailBodySet );
Blynk.notify ( String ( emailBodySet ) );
Serial.println ( "\nSetup complete \n*******************************\n*******************************\n" );
} //end setup
// KEEPING IT SIMPLE
void loop()
{
Blynk.run();
} // end loop
BLYNK_WRITE ( V1 )
{
Serial.println ( "Button pushed. Sending email.\n" );
Blynk.email ( EMAIL_ADDRESS, EMAIL_SUBJECT, EMAIL_BODY_BUTTON );
Blynk.notify ( emailBodyBut );
}
Serial output
=======================================
EMAIL DEMO
=======================================
[567] Connecting to Serengeti
[568] Connected to WiFi
[568] IP: 192.168.4.67
[569]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v1.0.0-beta.3 on NodeMCU
[576] Connecting to blynk-cloud.com:80
[619] <[1D|00|01|00] my-correct-authcode
[640] >[00|00|01|00|C8]
[640] Ready (ping: 21ms).
[640] Free RAM: 49624
[707] <[11|00|02|00]Over[00]1.0.0-beta.3[00]h-beat[00]45[00]buff-in[00]1024[00]dev[00]NodeMCU[00]build[00]May 8 2021 14:20:36[00]
From setup(). Sending email.
[708] <@[00|03|00|18]notify[00]Test from setup()
[711] <@[00|04|00|18]notify[00]Test from setup()
Setup complete
*******************************
*******************************
[727] >[00|00|02|00|C8]
[8212] >[14|00|0C|00|06]
[8213] >vw[00]1[00]0
Button pushed. Sending email.
[8213] <@[00|0C|00|1C]notify[00]Test from Button push
[8214] <@[00|0C|00|1C]notify[00]Test from Button push
[17732] >[14|00|0F|00|06]
[17732] >vw[00]1[00]1
Button pushed. Sending email.
[17733] <@[00|0F|00|1C]notify[00]Test from Button push
[17734] <@[00|0F|00|1C]notify[00]Test from Button push
[62734] <[06|00|05|00|00]
[62754] >[00|00|05|00|C8]
[107736] <[06|00|06|00|00]
[107752] >[00|00|06|00|C8]
[152738] <[06|00|07|00|00]
[152754] >[00|00|07|00|C8]
[197740] <[06|00|08|00|00]
[197760] >[00|00|08|00|C8]
[242742] <[06|00|09|00|00]
[242760] >[00|00|09|00|C8]
[287744] <[06|00|0A|00|00]
[287763] >[00|00|0A|00|C8]
[332746] <[06|00|0B|00|00]
[332764] >[00|00|0B|00|C8]