Home › Forums › The libraries hosted on the site › EMailSender send email with attachments › SMTP server to use with the EMailSender library › EMailSender using Ethernet Shield
- This topic has 3 replies, 1 voice, and was last updated 4 years, 1 month ago by
Renzo Mischianti.
-
AuthorPosts
-
-
21 April 2021 at 02:10 #11568
Davidd
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: }
-
21 April 2021 at 09:05 #11589
Hi Davidd,
if you use Ethernet Shield please refer to the articleSend email with attachments (v2.x library): Arduino Ethernet – 1
there are some limitation on secure connection and in Memory size like you can see on this topic
Using EMail Sender library with Arduino UNO Ethernet shield with Ethernet.h library
Bye Renzo
-
21 April 2021 at 20:55 #11606
Davidd, 19 años
Hello, thank you very much for your reply.
I have checked and indicates that the ethernet shield does not support SSL and TLS so it could not use Gmail as SMTP.On the contrary, it can be used as smtp for ethernet shield.
I created the account and generated a key for the connection, placed it in the program
arduino and it doesn’t work for me.Also put in the arduino program the
#define DEFAULT_EMAIL_NETWORK_TYPE_ARDUINO NETWORK_W5100
Code:
#define DEFAULT_EMAIL_NETWORK_TYPE_ARDUINO NETWORK_W5100 #include "Arduino.h" #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("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", "password", "mail@hotmail.com", "smtp.sendgrid.net", 25); 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("samueldavidrojasmaterano@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: }
-
22 April 2021 at 13:02 #11611
Hi Davidd,
follow the topic there is write that you must certificate the sender and you must change the define inside the file EMailSenderKey.h.Bye Renzo
-
-
AuthorPosts
- You must be logged in to reply to this topic.