Pages: [1]   Go Down
Author Topic: Ethernet Shield & E-mail  (Read 1019 times)
0 Members and 1 Guest are viewing this topic.
Houston Area
Offline Offline
Jr. Member
**
Karma: 0
Posts: 68
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Thanks
Randy
Logged

England
Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Houston Area
Offline Offline
Jr. Member
**
Karma: 0
Posts: 68
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Randy
Logged

England
Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Tesla Member
***
Karma: 143
Posts: 9579
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Email code you can try with your isp.

Code:
/*
12/21/11
SEND AN EMAIL WITH ARDUINO
 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()
{
  Serial.begin(9600);
  delay(10);
  //Ethernet.begin(mac, ip); //subnet and gateway may not be needed
  Ethernet.begin(mac, ip, subnet, gateway);
  delay(1000);
  Serial.println("Ready");
}

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)) {
    Serial.println("connected");
  }
  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);

  client.println("DATA");

  //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
  client.stop();
  Serial.println("disconnected");
  return 1; //send 1 (success) back to sendEmail() function
}

Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Houston Area
Offline Offline
Jr. Member
**
Karma: 0
Posts: 68
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Randy
Logged

Houston Area
Offline Offline
Jr. Member
**
Karma: 0
Posts: 68
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks zoomkat.
I will give it a try.
Logged

Pages: [1]   Go Up
Jump to: