Blynk Email and Push Notifications tutorial – ESP8266 Arduino Example

In this quick tutorial we are going to learn how to send emails and push notifications from the WiFi ESP8266 module, or any other IoT device, using Blynk Email and Push Notification APIs. For this demonstration we are going to build a simple thermometer project and then setup temperature Alarm points. Whenever the alarms will trigger, an email and a push notification will be sent.

Project difficulty

This project requires low to medium programming knowledge and medium electronics knowledge. To complete this project you will spend minimum 20 minutes.

At this time, from what I found, the simplest method to send Emails from a ESP8266 WiFi module is by using IoT Blynk platform. By calling Blynk APIs in Arduino code, we can achieve this very simple and fast. If this is your first time when hearing about ESP8266 modules you should first checkout this ESP8266 tutorial. Also if you are into IoT but you never used Blynk read here a complete Blynk tutorial with video examples.

Project setup – step by step

Setup your hardware project following the hookup sketch below (skip this, if you already have a working IoT test environment)

In the image below you can see Blynk Email and Push Notification Widgets in the widget box, and also dragged on the dashboard. The Email Widgets gives you the possibility to overwrite the email address from the application.

The Arduino code is pretty simple. The Arduino example below is made for a prototype using ESP8266 version 01 and DHT22 Temperature and Humidity sensor. The DHT22 is hooked on the GPIO02 and defined as DHTPIN 2. The readings are made in a loop interval of 2,5 seconds, as the DHT22 requires at least 2 seconds to refresh the measurements. Have a look over this code and after that we will continue the explaining:

As you can see in the example above, first line stands for calling the Blynk Email API. Execution is done with 3 parameters: email address, subject and body, pretty much familiar as in many programming languages.

Blynk Email limitation and downsides

Maximum allowed length is 120 symbols for all email + subject + message. However you can increase this limit if necessary by adding following commands to you sketch:

#define BLYNK_MAX_SENDBYTES XXX

Where XXX is desired max length of your email. For example for ESP you can set this to 1200 max length #define BLYNK_MAX_SENDBYTES 1200. Note that this line must be on top of any of the Blynk includes in your sketch.

The time limit between sending emails is minimum 15 seconds. In case you are using gmail you are limited with 500 mails per day (by google). Other providers may have similar limitations, so please be careful. The Blynk free cloud server gives you a maximum of 100 emails every day.

The second line obviously calls the Notification API which triggers Mobile OS specific notifications. The Blynk Push notification API offers two additional options as follows:

Notify when hardware offline – you will get push notification in case your hardware went offline.

Priority high priority gives more chances that your message will be delivered without any delays.

Blynk Push Notifications limitation and downsides

The notification body maximum length can have 120 symbols

Time limit between notifications is at least 15 seconds

I think that, for most of you, the above limitations will not affect the project flow. Therefore, this is a great way to achieve emails and push notifications, having no costs whatsoever. Even at some point we need to pay a bit to extend the Blynk potential, considering the benefits I really have no problem paying.

Hoping that this article inspired you, i kindly invite you sharethis article, subscribe my YouTube channel and join the communities on social networks. Please feel free to comment or send suggestions / remarks so i can improve the content quality!

i am working my final project which is pet feeder that is controlled by mobile phone apps, which is blynk. and i need the apps to send push notifications to remind the user to feed the pet. example is “feed me!”. and i need the push notification to send at least twice a day. i am very new to c programming and really in need of help. if you could help me feel free to contact me through my email ayuzee.am@gmail.com / charoigne@icloud.com. thnkyou so much. may god bless you.

I am using ET215 moisture sensor. How can I define my sensor on the code? Is there necessary download library for my sensor?
Thanks in advance

Radu C. Asandeisays:

Hi Lucian!
I’ve tried to compile your sketch from above, but it seems that you have used a different DHT library from what I have installed. Please, can you tell me from where I can get/download what you had used?
Thanks in advance.