Send email CC3000

Hi all, I have a temperature reader on my greenhouse that triggers a close/open of a hatch (linear actuator) and I want it to send an email to me when temperature reaches an extreme temperature. I downloaded the CC3000 library and I couldn't find a way to send a simple email. Then I created a Blynk account and tried to use that library, but didn't get very far (can't find a suitable code using CC3000 library and on the Blynk front, I can't get my device to appear on Blynk). I've also reviewed a few forums and I can't seem to find something that works for me. I need some guidance, whether it's to use 3rd party tools or something part of the CC3000 library, etc. Below is the code I tried using Blynk, but it doesn't connect to the internet (that's where the serial monitor stays forever)

/*************************************************************
For this example you need Adafruit_CC3000_Library library:
https://github.com/adafruit/Adafruit_CC3000_Library

Note: Firmware version 1.14 or later is preferred.

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 5 SECONDS!
*************************************************************/

// Template ID, Device Name and Auth Token are provided by the Blynk.Cloud
// See the Device Info tab, or Template settings
#define BLYNK_TEMPLATE_ID "the one Blynk gave me when I created a template especifically using Arduino and CC3000 shield"
#define BLYNK_DEVICE_NAME "Quickstart Device"
#define BLYNK_AUTH_TOKEN "the one Blynk gave me when I created a template especifically using Arduino and CC3000 shield"

// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
/* Set this to a bigger number, to enable sending longer messages */
//#define BLYNK_MAX_SENDBYTES 128

// These are the interrupt and control pins for СС3000
#define ADAFRUIT_CC3000_IRQ 3
#define ADAFRUIT_CC3000_VBAT 5
#define ADAFRUIT_CC3000_CS 10

//Constants
#define DHTPIN 2 // what pin we're connected to
#define DHTTYPE DHT22 // DHT22
#define actuator 4

#include <SPI.h>
#include <Adafruit_CC3000.h>
#include <BlynkSimpleCC3000.h>

//Libraries
#include <DHT.h>
#include "max6675.h" //for MAX6675 thermocouple chip

DHT dht(DHTPIN, DHTTYPE); // Initialize DHT sensor for normal 16mhz Arduino

char auth = BLYNK_AUTH_TOKEN;

// Your WiFi credentials.
// Choose wifi_sec from WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
char ssid = "my 2.4 wifi network";
char pass = "my password for that network";
int wifi_sec = WLAN_SEC_WPA2;

//Variables
float temp; //Stores temperature value
int maxTemp = 28; // define maximum temperature on which actuator starts
int minTemp = 20; // define minimmum temperature on which actuator retracts
int emailTemp= 35; // define minimmum temperature on which an email is sent

const int IN1_PIN = 7; // the Arduino pin connected to the IN1 pin L298N
const int IN2_PIN = 8; // the Arduino pin connected to the IN2 pin L298N

//initialising the thermocouple K / MAX6675
int thermoDO = 12;
int thermoCS = 11;
int thermoCLK = 13;

// initialise MAX6675
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);

void setup()
{
// Debug console
Serial.begin(115200);
//Initialize the DHT sensor
dht.begin();

// initialize digital pins as outputs.
pinMode(IN1_PIN, OUTPUT);
pinMode(IN2_PIN, OUTPUT);

// wait for MAX chip to stabilize
delay(500);

Blynk.begin(auth, ssid, pass, wifi_sec);
Serial.print("connected");
Blynk.email("my email", "test", "test");

}

void loop()
{
Blynk.run();

//Read data and store it to variable temp (adds 4 degrees as I've noticed that this is the amount by which the temperature is off)
temp= thermocouple.readCelsius()+4;

//show the temperature of both the DH22 and the MAX6675. the latter one controls the actuator
Serial.print("C DH22 = ");
Serial.print(dht.readTemperature());
Serial.print("C MAX6675= "); 
Serial.println(temp);

if (temp>emailTemp){
        // Just put the recepient's "e-mail address", "Subject" and the "message body"
    Blynk.email("my email", "Greenhouse - Open hatch", "The greenhouse temperature is above 35C, it needs the hatch to be manually opened all the way up.");
    delay (10000);
    Blynk.email("my email", "Greenhouse - Open hatch", "The greenhouse temperature is above 35C, it needs the hatch to be manually opened all the way up.");
    delay (5000);
}
else if(emailTemp >temp > maxTemp) {
    // extend the actuator
    digitalWrite(IN1_PIN, HIGH);
    digitalWrite(IN2_PIN, LOW);
    //only open for 5 seconds and leave it half way unless it has reached end of path
    delay (5000);
    digitalWrite(IN1_PIN, LOW);
    digitalWrite(IN2_PIN, LOW);
} 
else if (temp <minTemp){
    // retracts the actuator
    digitalWrite(IN1_PIN, LOW);
    digitalWrite(IN2_PIN, HIGH);
    //only open for 5 seconds and leaves it half way unless it has reached end of path
    delay (5000);
    digitalWrite(IN1_PIN, LOW);
    digitalWrite(IN2_PIN, LOW);

}
else {
// stops
digitalWrite(IN1_PIN, LOW);
digitalWrite(IN2_PIN, LOW);
}

//30 secs delay between reads. provides enough time for temperature to stabilise when the hatch is half opened
delay(30000);

}

I found the CC3300 very unreliable, with frequent "hangs" (see below). Suggest tossing it in the trash and using an ESP8266 or ESP32 with this library: https://github.com/mobizt/ESP-Mail-Client

Thanks very much Dave. I read a little bit about ESP-01 ESP8266. It seemed it involved a lot of steps involving not only arduino IDE libraries, but other stuff needed to be installed on Windows (in below post). Is this the easiest way to send an email from an arduino? If it is, I'll suck it up :slight_smile:

I'll go with this. Looks simple enough! Thanks very much!