To send Sensor data on gmail

I want to send my temperature sensor data on mail but I am unable to send variable value on mail. @discobot

Something like this could be an option for e.g. a float value:

char str[50];
sprintf(str, "String value: %f ℃", f);
Blynk.email("my_email@example.com", "Subject", str);

or:

String str = "String value: " + String(f, 1) + "℃";
Blynk.email("my_email@example.com", "Subject", str);
1 Like

Thanks I got it. I can combine 2 strings and put it in third then send it.:+1:

Blynk is not sending mail initially it sent 30 mails but with same code it’s not responding I’ve used example section of Arduino IDE.

How often do you send the email and what does the subject and the content of the email look like?
Providing the code would help … :wink:

Have you read the documentation about email?

http://docs.blynk.cc/#widgets-notifications-email

There are limits to how frequently you can send emails and how many can be sent per day. These vary depending on whether you use local or cloud server.

Obviously, bombarding yourself with pointless emails has no real value. You need to decide what info you really need to receive by email - temperature goes above or below certain thresholds is one example, or maybe a daily ‘digest’ email containing minimum, maximum and average values (but beware of the maximum character limit for email length).

If you are going for minimum/maximum alert emails then you only really want to receive one, possibly followed by another once the temperature is back in range. To do this you’ll need a flag to record that an over temperature email has been sent, so that if this flag is true then no more over temperature emails are sent. The flag needs to be reset when the temperature drops below the threshold (probably with a bit of latitude, so that when the temperature is hovering around the threshold you don’t keep getting notified).

Pete.

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = “9e89ee9aec254e13b96a0213289*****”;
char ssid[] = “Bloodborn”;
char pass[] = “born2911998”;

void emailOnButtonPress()
{
int isButtonPressed = !digitalRead(2); // Invert state, since button is “Active LOW”
if (isButtonPressed) // You can write any condition to trigger e-mail sending
{
Serial.println(“Button is pressed.”); // This can be seen in the Serial Monitor
Blynk.email("vmourya716@gmail.com", “Subject: Button Logger”, “You just pushed the button…”);
}
}

void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
Blynk.email("vmourya716@gmail.com", “Subject”, “My Blynk project is online.”);
pinMode(2, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(2), emailOnButtonPress, CHANGE);
}

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

no error but no response also yesterday it was working ive sent 30+ mails with that.

What kind of respose do you expect?

A mail on button press that I’ve connected on pin 2 (d4). And can I use LCD as well mail widget in one project paralelly will it work properly.

Can you please explain the syntax of String(f, 1) ? What does the “1” stand for?

I need to send an integer value of generally 4 digits over email: what would the correct syntax be?

Whoa! Timewarp…

The ‘1’ is the number of decimal places required to display the float value with.

1 Like

Ah ok; so if f is an integer, then the following should be used? String(f);

1 Like

Yes, correct :slight_smile: