[SOLVED] Blynk.email seems limited to 97 characters

I have been trying to use the email widget to send a daily mail message but I cannot get a message with more than 97 characters to be sent. In my code this message is sent.

Good Morning
I’m very cold today
It is 8:07 and the temp is 70’ with humidity at 40 percent. By

If I try to finish the last word and add an “e” no message is sent.
I am using an esp8266 and Android.

#define BLYNK_PRINT Serial

#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <ESP8266WiFi.h>

#define WLAN_SSID "xxx"
#define WLAN_PASS "xxx"

SimpleTimer timer;
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

short temperature = 70;
short humidity = 40;
void setup() {
  Blynk.begin(auth, WLAN_SSID, WLAN_PASS);
  timer.setInterval(60000, TestMail);
  timer.setInterval(1000, CountDown);

void loop() {

void TestMail(){
  Serial.println("Sending Test Mail");
  SendMessage(8, 7);

void SendMessage(short dawnHour, short dawnMinute){  
  String mailSubject = "Test Mail";
  String mailMessage = "";
  mailMessage = "Good Morning\nI'm very cold today\n";
  mailMessage += "It is ";
  mailMessage += dawnHour;
  mailMessage += ":";
  if (dawnMinute < 10){ mailMessage += "0"; }
  mailMessage += dawnMinute;
  mailMessage += " and the temp is ";
  mailMessage += temperature;
  mailMessage += "' with humidity at ";
  mailMessage += humidity;
  mailMessage += " percent. By";

//  mailMessage += "e";

  Blynk.email("prez_obama@gmail.com", mailSubject, mailMessage);

void CountDown(){

Thank you for reporting. We will have a look.

I noticed that too @julieisdead


I have included a BLYNK_MAX_SENDBYTES option, which allows you to increase maximum message size.
Just put this line before including Blynk library:


This will allow you sending something like 230 bytes of message body.
You can increase the number further.

@vshymanskyy without using BLYNK_MAX_SENDBYTES what is the actual maximum number of characters and is there a breakdown between the maximum for the email subject and the email content?

@vshymanskyy please update docs and sketches with that info.

@vshymanskyy with #define BLYNK_MAX_SENDBYTES 256 before the Blynk library we are able to email a 200 character byte array but not one containing 220 characters. The subject of the email is 20 characters so we were expecting the subject plus the body of 220 characters (total 240 characters) to be covered by the 256 bytes.

We have also tried increasing the 256 to 512 but we are still can’t send 220 byte body emails. Any ideas?

It might be Blynk server limitation that it wont accept larger packets so even changing libs might be not enough we need to wait for comments from dev.

No, it is not. It is library issue.

@Dmitriy and @Costas

True I solved this problem you need to increase BLYNK_MAX_READBYTES along with BLYNK_MAX_SENDBYTES. This way you can send larger messages. Basically BLYNK_MAX_READBYTES has to be at least the size of BLYNK_MAX_SENDBYTES.

1 Like

Why do you think so?.. Shouldn’t be this way.

Ok I found direct cause of the bug. In BlynkProtocol.h you have:

void BlynkProtocol<Transp>::sendCmd(uint8_t cmd, uint16_t id, const void* data, size_t length, const void* data2, size_t length2)
    if (0 == id) {
        id = getNextMsgId();

    BLYNK_LOG("<msg %d,%u,%u", cmd, id, length+length2);

    if (!conn.connected() || (cmd != BLYNK_CMD_LOGIN && state != CONNECTED) ) {
        BLYNK_LOG("Cmd skipped");

#if defined(BLYNK_SEND_ATOMIC)|| defined(ESP8266) || defined(SPARK) || defined(PARTICLE) || defined(ENERGIA)
    // Those have more RAM and like single write at a time...

    uint8_t buff[BLYNK_MAX_READBYTES]; // TODO: Eliminate constant
    BlynkHeader* hdr = (BlynkHeader*)buff;
    hdr->type = cmd;
    hdr->msg_id = htons(id);
    hdr->length = htons(length+length2);

    size_t len2s = sizeof(BlynkHeader);
    if (data && length) {
        memcpy(buff + len2s, data, length);
        len2s += length;
    if (data2 && length2) {
        memcpy(buff + len2s, data2, length2);
        len2s += length2;
    BLYNK_DBG_DUMP("<", buff+5, len2s-5);
    size_t wlen = 0;

#define BLYNK_SEND_CHUNK 1024 // Just a big number

affected line is declaration of buff variable which is declared of size BLYNK_MAX_READBYTES should be BLYNK_MAX_SENDBYTES. In this case without change you get buffer overflow as the data overwrites content of the memory outside of the buffer.

ps. that’s why it worked with both sizes equal


Yes you’re right. Thanks for pointing this out.
I have fixed this in the master branch (Eliminated constant).
Hope that helps!

1 Like