Please overload Blynk.email() for String recipient

I would like to suggest that the Blynk.email(); function be overloaded to allow String type recipients.

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include "Sandbox.h" // defines auth, ssid, password 
//===================================================================
const String emailMe = "dale@example.com";
const char emailchar[] = "dale@example.com";
const String emailsubject = "Temp alert!"; 
const String emailcontent = "This is the content ";
//===================================================================
void setup() {
  
    Blynk.begin(auth, ssid, pass); // get onto wifi network

    //Blynk.email(emailMe, emailsubject, emailcontent); // fails to compile, recipient may not be a String
    Blynk.email("dale@example.com", emailsubject, emailcontent); // works 
    Blynk.email(emailchar, emailsubject, emailcontent); // works
}

void loop()
{
  Blynk.run();
}

I have used similar methods like this and they work fine for accepting various stringsā€¦ E.g. Case 3 takes the recipient email address as a String from a Text Input Widget

Note the .c_str() after the email address in Blynk.email() Admittedly I am not entirely understanding why it is needed only for the address, but it works.

String emailAddress;
String emailSubject;
String emailMessage;

BLYNK_WRITE(vPin1) {  // Text Input Widget
  emailAddress = param.asStr();
}

BLYNK_WRITE(vPin2) {  // Segmented Switch
  switch (param.asInt()) {
    case 1: { // Item 1
        emailAddress = "myemail@gmail.com";
        emailSubject = "Test ONE";
        emailMessage = "Test ONE occurring at ";
        emailMessage += millis();
        emailMessage += " milliseconds";
        break;
      }
    case 2: { // Item 2
        emailAddress = "youremail@gmail.com";
        emailSubject = "Test TWO";
        emailMessage = "Test TWO occuring at ";
        emailMessage += millis();
        emailMessage += " milliseconds";
        break;
      }
    case 3: { // Item 3
        // Address pulled from Text Input Widget
        emailSubject = "Test THREE";
        emailMessage = "Test THREE occuring at ";
        emailMessage += millis();
        emailMessage += " milliseconds";
        break;
      }
  }
  Blynk.email(emailAddress.c_str(), emailSubject, emailMessage);
}

yes, I presented a workaround already. C++ functions can be overloaded and there is an overload declaration missing (String, String, String)

5 posts were split to a new topic: How to include variable value in an email

A post was merged into an existing topic: How to include variable value in an email