Pages: [1] 2   Go Down
Author Topic: Need A Computer Program That Sends Mail With Arduino Trigger.  (Read 1357 times)
0 Members and 1 Guest are viewing this topic.
HK
Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
Micro
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I need A Windows Program That sends a mail to configured mail address when a sensor triggers the arduino the Program need mail send function to Gmail. Please give some Idea. Also Please dont suggest Gobetwino , I already tested It and Found Some Bugs in The Software and also it cannot send mail to Gmail. Thanks.
Logged

Peter.

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 138
Posts: 5846
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why do you need a Windows program? If it works, the Arduino will work. I send email to my gmail account with my ethernet shield.
http://playground.arduino.cc/Code/Email
The email sending block is normally by ip address ranges. If one fails in that ip range, probably all ips in that subnet range will fail to send email.
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 13
Posts: 257
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I need A Windows Program That sends a mail to configured mail address when a sensor triggers the arduino the Program need mail send function to Gmail. Please give some Idea. Also Please dont suggest Gobetwino , I already tested It and Found Some Bugs in The Software and also it cannot send mail to Gmail. Thanks.

I can write a program for you, but I don't have that much free time =D.. A quick google search came up with a processing sketch of sending emails using a gmail POP/SMTP server. And another google search came up with how to setup your gmail with a POP/SMTP server =D..

Processing sketch: http://www.shiffman.net/2007/11/13/e-mail-processing/
Gmail to POP/SMTP: https://support.google.com/mail/troubleshooter/1668960?hl=en#ts=1665119,1665162

//Basel
« Last Edit: May 17, 2013, 01:27:34 pm by baselsw » Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 138
Posts: 5846
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@basilsw: Neither of those links do a bit of good for an Arduino, except for basic theory.

I am lucky. I have my own SMTP server that my ISP seems to love (takes the load off their server). If this becomes a problem, many recommend SMTP2GO for that kind of stuff.
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 13
Posts: 257
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, I didn't say that it's a complete solution.. It's a good start-point.. You'd have to change a couple of things in the processing sketch, like adding serial capability (there is a library for that, use google) and setup some kind of communication "protocol" for the serial com between arduino and processing (like if serial.read equals 1 send a email with the following message, etc).

But like I said, you'd have to do a little work (YAYY =D). Otherwise I hope someone else here have some other kind of solution for you..

Good luck =)

//Your friendly neighbourhood spider-man
Logged

HK
Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
Micro
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi , baselsw Thanks for Given Info I will Try it and reply , Thanks again.
Logged

Peter.

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

 I try to send Email with my arduino Due with ethernet shield.

 I use the sketch : "Email client sketch for IDE v1.0.1 and w5100/w5200  Posted December 2012 by SurferTim" found in this forum

But does'nt work.... I got on the serial monotor:

Ready. Press 'e' to send.
connected

Timeout (from the sub-routine eRcv)
Email failed

Any sugestion......thank a lot.....

Alain
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 138
Posts: 5846
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Prof: Post your code. I know it is from the playground, but a few changes needed to be made by you, and I want to check them.
Logged

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

Here is my code:

Code:
/*
    Email client sketch for IDE v1.0.1 and w5100/w5200
    Posted December 2012 by SurferTim
 */

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

// this must be unique
 byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; 
// change network settings to yours
 IPAddress ip( 192, 168, 0, 198 );   
 IPAddress gateway( 192, 168, 0, 1 );
 IPAddress subnet( 255, 255, 255, 0 );

// change server to your email server ip or domain
// IPAddress server( 1, 2, 3, 4 );
char server[] = "mail.navigue.com";

 EthernetClient client;

void setup()

{


  Serial.begin(9600);
   pinMode(4,OUTPUT);
   digitalWrite(4,HIGH);
   Ethernet.begin(mac, ip, gateway, gateway, subnet);

   delay(2000);
   Serial.println("Ready. Press 'e' to send.");
}

void loop()
{
   byte inChar;

   inChar = Serial.read();

   if(inChar == 'e')
   {
       if(sendEmail()) Serial.println("Email sent");
       else Serial.println("Email failed");
   }
}

 byte sendEmail()
{
   byte thisByte = 0;
   byte respCode;

   if(client.connect(server,25)) {
     Serial.println("connected");
   } else {
     Serial.println("connection failed");
     return 0;
   }

   if(!eRcv()) return 0;
   Serial.println("Sending hello");
// change to your public ip
   client.println("My public IP");

   if(!eRcv()) return 0;
   Serial.println("Sending From");

// change to your email address (sender)
   client.println("MAIL From: <pif_paf_pouf@hotmail.ca>");

   if(!eRcv()) return 0;

// change to recipient address
   Serial.println("Sending To");
   client.println("RCPT To: <arduino1967@hotmail.ca>");

   if(!eRcv()) return 0;

   Serial.println("Sending DATA");
   client.println("DATA");

   if(!eRcv()) return 0;

   Serial.println("Sending email");

// change to recipient address
   client.println("To: You <arduino1967@hotmail.ca>");

// change to your address
   client.println("From: Me <pif_paf_pouf@hotmail.ca>");

   client.println("Subject: Arduino email test");

   client.println("This is from my Arduino!");

   client.println(".");

   if(!eRcv()) return 0;

   Serial.println("Sending QUIT");
   client.println("QUIT");

   if(!eRcv()) return 0;

   client.stop();

   Serial.println("disconnected");

   return 1;
}

 byte eRcv()
{
   byte respCode;
   byte thisByte;
   int loopCount = 0;

   while(!client.available()) {
     delay(1);
     loopCount++;

     // if nothing received for 10 seconds, timeout
     if(loopCount > 20000) {
       client.stop();
       Serial.println("\r\neRcv-Timeout");
       return 0;
     }
   }

   respCode = client.peek();

   while(client.available())
   { 
     thisByte = client.read();   
     Serial.write(thisByte);
   }

   if(respCode >= '4')
   {
     efail();
     return 0; 
   }

   return 1;
}


void efail()
{
   byte thisByte = 0;
   int loopCount = 0;

   client.println("QUIT");

   while(!client.available()) {
     delay(1);
     loopCount++;

     // if nothing received for 10 seconds, timeout
     if(loopCount > 20000) {
       client.stop();
       Serial.println("\r\nefail-Timeout");
       return;
     }
   }

   while(client.available())
   { 
     thisByte = client.read();   
     Serial.write(thisByte);
   }

   client.stop();

   Serial.println("disconnected");
}


I work on it last night and my first error was to don't have the good mail server name (mail.navigue.com)

NOw I get that message on arduino monitor :

Ready. Press 'e' to send.
connected
220 mail.navigue.com ESMTP Postfix
Sending hello
502 5.5.2 Error: command not recognized
221 2.0.0 Bye
disconnected
Email failed

I thnk I don't send the right command to my mail server ?

Thank again for your help.....very appreciate.....
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 138
Posts: 5846
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It is failing at this send:
Code:
  client.println("My public IP");
   // change to this
   client.println("helo 1.2.3.4");
It is best to put your public ip there instead of 1.2.3.4.

edit: Your next problem should be it will not take email for a hotmail account. If you want to send email like this, it needs to be sent to the email server that handles the email for that domain.
« Last Edit: May 26, 2013, 07:25:55 am by SurferTim » Logged

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

GReeeaaaattttt.....working now  smiley-grin

I was putting my public IP in that line .....but not the "helo" before it.

That was the problem......

Thank a lot SufferTim...... great job you're doing....

Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 138
Posts: 5846
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks!  smiley
Logged

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

It seem then my email server handle Hotmail domain.
Make two différents mail in lthe last minute.....and work well.
 smiley-grin

Thank again
Logged

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

If I want to have the message on my cellular phone ?

I will have to use a program like Twitter or Hotmail can do that ?
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 138
Posts: 5846
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If it relays to Hotmail, then that would usually indicate the email server for that domain is an open relay. That is not a good thing. Spammers will use it to relay spam all over the place.

If you have an email account monitored by your cellphone, you should be able to send email to it. If you want to send a text message (SMS), then read this post:
http://forum.arduino.cc/index.php?topic=157013.msg1202024#msg1202024
Logged

Pages: [1] 2   Go Up
Jump to: