Site icon Renzo Mischianti

EMailSender using Ethernet Shield

I am trying to use EMailSender using Ethernet Shield but it is not working. I already followed the steps in the documentation but it doesn't work for me.

#include <SPI.h>
#include <Ethernet.h>

#include <EMailSender.h>

// 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("sistem@gmail.com", "password");

void setup() {
// Open serial communications and wait for port to open:
	Serial.begin(115200);
// while (!Serial) {}

	delay(2000);

	Serial.println("Starting!");

// 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());

	EMailSender::EMailMessage message;
	message.subject = "Soggetto";
	message.message = "Ciao come stai<br>io bene.<br>www.mischianti.org";

	EMailSender::Response resp = emailSend.send("mail@gmail.com", message);

	Serial.println("Sending status: ");

	Serial.println(resp.status);
	Serial.println(resp.code);
	Serial.println(resp.desc);
}
void loop() {
// put your main code here, to run repeatedly:

}
Exit mobile version