Docs

Email

The Email widget sends a message to an inbox. Your board calls it, the server delivers it.

Use it for: a daily report, an alert you want a record of, a log you forward to someone else. A notification is faster to read, an email stays.

SettingWhat it does
Tothe address that receives the message, your account address by default
Subjecta default subject the sketch can override

Open these from the canvas: tap Edit, then long press the widget and choose Configure.

Example

A daily summary at the end of the day.

email.ino
#include <PlynxSimpleEsp32.h>

PlynxTimer timer;
float peakTemp = -99;

void trackPeak()
{
  float celsius = analogRead(34) * (3.3 / 4095.0) * 100.0;
  if (celsius > peakTemp) {
    peakTemp = celsius;
  }
}

void sendReport()
{
  String body = "Peak temperature today: " + String(peakTemp, 1) + " C";
  Plynx.email("Greenhouse report", body.c_str());
  peakTemp = -99;
}

void setup()
{
  Serial.begin(115200);

  // Auto setup: WiFi and the Plynx token are configured from the app.
  //
  // To provide them directly in the sketch instead, use:
  //   Plynx.begin(auth, ssid, pass);
  Plynx.begin();

  timer.setInterval(60000L, trackPeak);
  timer.setInterval(86400000L, sendReport);
}

void loop()
{
  Plynx.run();
  timer.run();
}

Plynx.email(subject, message) sends to the address in the widget settings. Plynx.email(address, subject, message) sends somewhere else.

Email is slow and rate limited. Use it for something you want to keep, and use a notification for something you need to know now.

Troubleshooting

ProblemCheck
Nothing arriveslook in the spam folder first
Only the first email arrivesthe server is rate limiting; send less often
Message is cut offkeep the body short, it is not a file transfer
Wrong addressthe To field in the widget settings, or pass the address in code

Next