Site icon Renzo Mischianti

Email Sender not working Arduino uno – W5100

Hello, im currently having the problem with my Arduino Uno + NETWORK SHIELD W5100 that when i try to make a code which sends an email when the temperature is hot its not working and giving me this output. Sending status: 0 2 Here is my code: #include <Ethernet.h> #include <SPI.h> #include <EMailSender.h> #include <OneWire.h> #include <DallasTemperature.h> #include <LiquidCrystal_I2C.h> #include <Arduino.h> LiquidCrystal_I2C lcd(0x27, 16, 2); // Enter a MAC address for your controller below. // Newer Ethernet shields have a MAC address printed on a sticker on the shield byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; EMailSender emailSend("apikey", "apikey", "email", "smtp", port); // these are correct #define ONE_WIRE_BUS 2 // Pin where the DS18B20 is connected OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); const int testnr = 30; void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); lcd.init(); lcd.backlight(); lcd.setCursor(0, 0); lcd.print("PEGASUS"); lcd.setCursor(0, 1); lcd.print("Measure it"); delay(2000); lcd.clear(); // start the Ethernet connection: if (Ethernet.begin(mac) == 0) { Serial.println("Failed to configure Ethernet using DHCP"); while(1); } Serial.print("IP address "); Serial.println(Ethernet.localIP()); lcd.init(); lcd.backlight(); lcd.setCursor(0, 0); lcd.print("IP-Adresse"); lcd.setCursor(0, 1); lcd.print(Ethernet.localIP()); delay(2000); lcd.clear(); sensors.begin(); // Initialize DS18B20 senso } void loop() { sensors.requestTemperatures(); // Request temperature readings float temperature = sensors.getTempCByIndex(0); // Read temperature in Celsius from first sensor Serial.print("Temperature: "); Serial.print(temperature); Serial.println(" °C"); lcd.setCursor(0, 0); lcd.print("Temperature:"); lcd.setCursor(0, 1); lcd.print(temperature); lcd.print((char)223); lcd.print("C"); lcd.print(" | "); lcd.print(DallasTemperature::toFahrenheit(temperature)); lcd.print(" F"); delay(5000); // Add a delay to prevent flooding the serial monitor // Read temperature here and check if it's above 29°C if (temperature > 30) { EMailSender::EMailMessage message; message.subject = "Temperatur"; message.message = "Hallo, die Raum Temperatur ist sehr hoch!"; EMailSender::Response resp = emailSend.send("mail", message); //my email Serial.println("Sending status: "); Serial.println(resp.status); Serial.println(resp.code); Serial.println(resp.desc); } }
Exit mobile version