Hi all,
I’m trying to use a string variable to contain an email address looked up from an SD card file.
If I code it just as advised, it compiles fine. But, if I replace "email@somewhere.com" with a string variable eMailAddress, the compiler chokes.
Ideas?
Thanks in advance.
Jim-
Search this forum for keywords like email and String… there are various procedures to building a single string from multiple sources prior to emailing it. It is actually an Arduino code thing, not specific to Blynk, so Googling how strings work is also advisable.
Check your compiler error. I am not super savvy on String theory I Google a lot to figure it out and keep trying till it works.
For example, this is what I have in one of my projects… note how I built up the body before processing it in the email command.
void StartUpEmail()
{
timeDisplay();
dateDisplay();
String emailAddress = "xxxxxxxxxx@gmail.com";
String subject = "Mega CodeShield Started";
String body = "Your CodeShield progect on the Mega has started at " + String(currentTime) + " on " + String(currentDate);
Blynk.email(emailAddress.c_str(), subject.c_str(), body.c_str());
}
BTW, a string entry widget would be nice.
One can use the terminal as such but it would be really nice to have separate entries like: Fname, Lname, email…
When a button is pushed it can consolidate all and create a record via SD.