Go Down

Topic: Ethernet Shield & E-mail (Read 2440 times) previous topic - next topic


Good day,

Trying to send email using SMTP from my computer telent session first then once that works I will program the Arduino.
Been testing for the last few weeks without success.
Opened e-mail accounts with different vendors.
Tried AUTH and many different approaches. Found many examples on the Internet.
I can connect through telnet in some cases but nothing is sent. Other mail servers I can't connect at all.

Has anyone had success sending SMTP emails from Arduino-Ethernet Shield?



Which vendors? Some free or limited facility cheap accounts may block telnet access.

Which guides? Maybe some are incorrect or you are not following them properly.

What problems are you having? "It doesn't work" doesn't really mean much.


Thanks for the reply.

I created an account with gmx and inbox for example.
I can go through the telnet session, I'm at work so I don't have it in front of me.

The info I got from the net for smtp e-mail but I don't have the doc. When I get home I can get the details. Many documents out there.

I go through the commands as demonstrated in the doc in a telnet session...port 25 without error but the e-mail never makes it to my inbox.

Try sending an e-mail to my home account.
If anyone has success sending e-mail then I'm curious on who they used and the commands.
Perhaps they use their own mail server which I could setup but not my best option.

Gmx perhaps turns off relaying...I'm not sure, can't get any answers from them.



Without looking into it too deeply I'd say free email accounts are a no-no for telnet. You could do with unrestricted access to your own domain, sending mail can be quite a challenge these days! I can send via telnet on my domains.


Email code you can try with your isp.

Code: [Select]
for IDE 1.0
This code was created by modifying the connect example from
arduino.cc and with the help of the YABB forums and their very
helpful members. This code sends an email to any email address
and then disconnects. Make sure to replace all the *'s with
your own information.
Send e in serial monitor to send email

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

// Change these next 4 entries to your network settings
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; 
byte ip[] = { 192, 168, 1, 102 }; 
byte subnet[] = { 255, 255, 255, 0 };
byte gateway[] = { 192, 168, 1, 1 };
byte server[] = { abc, abc, abc, abc }; //your smtp server
EthernetClient client;

void setup()
  //Ethernet.begin(mac, ip); //subnet and gateway may not be needed
  Ethernet.begin(mac, ip, subnet, gateway);

void loop()
  byte inChar;
  inChar = Serial.read();
  if(inChar == 'e')
    if(sendEmail()) Serial.println("Email sent"); //start sendEmail()
    else Serial.println("Email failed");

//////////////////////////////// email function
byte sendEmail()  //sendEmail() function that returns 1 or 0
  //start and check for email server connection
  if (client.connect(server,25)) {
  else {
    Serial.println("connection failed");
    return 0; //send 0 (failed) back to sendEmail() function
  //wait for server "queing" response
  while(!client.available()) delay(1);

  client.println("HELO itismeletschat"); /*hello (statement after helo is needed but irrelevant)*/

  //wait for server "hello" response
  while(!client.available()) delay(1);

  client.println("MAIL From: me@athome.net"); // identify sender, this should be the same as the smtp server you are using*/

  //wait for server "sender ok" response
  while(!client.available()) delay(1);

  client.println("RCPT To: you@athome.net"); /* identify recipient */

  //wait for server "receipent ok" response
  while(!client.available()) delay(1);


  //wait for server to say "enter your message" response
  while(!client.available()) delay(1);

  //send email message to server
  client.println("To: you@athome.net"); /* identify recipient */
  client.println("Subject: You Have Arduino Mail!!"); /* insert subject */
  client.println("Please let me know it worked!!!"); /* insert body */
  client.println("."); /* end email */

  //wait for server "message accepted" response
  while(!client.available()) delay(1);

  client.println("QUIT"); /* terminate connection */
  //wait for server "goodby" response
  while(!client.available()) delay(1);

  //stop client connection
  return 1; //send 1 (success) back to sendEmail() function

Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0


I would agree with you since I'm sure spammers would take advantage of it. I thought I would ask and see if anyone was doing something that worked.
Perhaps I will have to setup my own mail server.

Thanks for your comments.


Thanks zoomkat.
I will give it a try.

Go Up