Blynk.email("郵件位址", "主旨", "郵件內容");
Blynk.email() 一次只能傳一個郵件位址, 若要傳給多個信箱, 要分次呼叫.
/*************************************************************
Simple e-mail example
App project setup:
E-mail Widget
Connect a button to digital pin 2 and GND
Pressing this button will send an e-mail
WARNING: You are limited to send ONLY ONE E-MAIL PER 15 SECONDS!
*************************************************************/
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
SimpleTimer timer;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "461366bb2e7d4216b7b10a0d4d785da7c3b";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "74170287";
char pass[] = "24063173";
/* Set this to a bigger number, to enable sending longer messages */
//#define BLYNK_MAX_SENDBYTES 128
void emailUptime() {
long uptime=millis() / 6000L;
Serial.println("Email every 1 minutes :)");
Blynk.email("alex9ufo@gmail.com", "Running time", String("Running for ") + uptime + " minutes.");
}
void setup() {
Serial.begin(9600); //Set console baud rate
Blynk.begin(auth, ssid, pass);
while (Blynk.connect() == false) {} //wait until connected
timer.setInterval(1L * 60000L, emailUptime); //Don't send more that 10 values per second
}
void loop() {
Blynk.run();
timer.run();
}
沒有留言:
張貼留言