what is the best device for sending email?

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
metal693
 
Posts: 5
Joined: Tue Sep 03, 2013 10:59 pm

what is the best device for sending email?

Post by metal693 »

I am a programming noob. I tried to send Smtp email with arduino mega and could not get it to work. I tried to learn php and downloaded wamp and still could not get the arduino to send me an email when an alert is triggered.

I need something like arduino that can receive data from multiple arduinos via xbees and send me an email when alerts are triggered.

I need something that can act like a webserver and send smtp emails with authentication without having to use php or wamp etc. I would prefer this to be used as a stand alone device. The device can connect to the internet wireless or via Ethernet cable.

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: what is the best device for sending email?

Post by Franklin97355 »

The Raspberry pi can do that. As can the beagle Bone Black or an Arduino with a wifi shield or the CC3000 breakout board.

metal693
 
Posts: 5
Joined: Tue Sep 03, 2013 10:59 pm

Re: what is the best device for sending email?

Post by metal693 »

How can an arduino with a wifi shield send emails when an arduino with an ethernet shield cannot? Also I did some searching today on the beaglebone black and could not find a single example where you could send an email with one. Basically the same scenario with the raspberry pi.

I tried for about a week to get the arduino to send me an email and could not get it to work. It seems like the only way any of these boards will send an email is if you have a dedicated computer running wamp or php or if you have a double twitter account etc. I am already having difficulty learning arduino. To have to stop learning arduino so I can learn php and smtp etc is a real drag. Sending me a text based on an event is supposed to be simple. So far its a nightmare and not possible.

all i need is some device that can send an alert like "water leak" to an email. This one tiny piece of my project is so convoluted and difficult that im ready to abandon the whole project. I have read several hundred posts now. With 0 answers to my simple question.

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: what is the best device for sending email?

Post by Franklin97355 »

https://www.google.com/search?q=email+w ... age=1&rlz=
If you post your code (between

Code: Select all

 tags) perhaps we can find out why it is not working.

User avatar
brucef
 
Posts: 215
Joined: Tue May 03, 2011 4:51 pm

Re: what is the best device for sending email?

Post by brucef »

I don't know anything about sending email from an Arduino, but Rasberry Pi and BeagleBone boards both run Linux so sending an email from them should be fairly straightforward.

To start, construct a message file that looks like so:

Code: Select all

From: me@mypi
To: [email protected]
Subject: Testing email

After a blank line, you put in the body text.
Then, assuming you called this file /tmp/test_message.txt, you pipe it to sendmail like so:

Code: Select all

cat /tmp/test_message.txt | sendmail [email protected]
As long as you have your Pi (or Bone) connected to your LAN, and as long as you have some sort of sendmail program installed, the message should be delivered to the address you specify as an option to sendmail. I'm not sure if sendmail is present on the Pi by default. I'll check my board (running Occidentalis) when I get the chance.

metal693
 
Posts: 5
Joined: Tue Sep 03, 2013 10:59 pm

Re: what is the best device for sending email?

Post by metal693 »

I know how to do a Google search. If it had returned any information about what I need to do I wouldn't be here. Those kind of answers are not helpful. As far as posting code, I tried everything from Google link you posted. None of them worked so I'm not sure which one to post. I was hoping to find someone that has actually gotten this to work

I wasn't aware that raspberry pi and beagle bone used Linux. I've never used Linux. But I like the idea of connecting the raspberry pi to my router and have it send me a text. As long as I don't have to have a dedicated home computer running some other software like php etc. So far the arduino can do everything I need except send an alert to my email address.

User avatar
brucef
 
Posts: 215
Joined: Tue May 03, 2011 4:51 pm

Re: what is the best device for sending email?

Post by brucef »

Okay, so my approach worked on my Raspberry Pi, although as expected I had to install something with a 'sendmail' binary. (You can tell if you have one already by typing 'which sendmail' - if you get get a response something like '/usr/sbin/sendmail' it's installed, while no response probably means it isn't.)

I chose postfix as my mailer, installed by logging in as root and typing 'apt-get install postfix'. It asked me during the install about how I wanted to configure my server and I picked the default option, something like 'internet-mail'. Once the install was complete I had a working sendmail binary and I could send email to my Gmail account from the Pi on my LAN.

mwilson
 
Posts: 46
Joined: Sun Oct 23, 2011 11:17 am

Re: what is the best device for sending email?

Post by mwilson »

metal693 wrote:I tried for about a week to get the arduino to send me an email and could not get it to work. It seems like the only way any of these boards will send an email is if you have a dedicated computer running wamp or php or if you have a double twitter account etc. I am already having difficulty learning arduino. To have to stop learning arduino so I can learn php and smtp etc is a real drag. Sending me a text based on an event is supposed to be simple. So far its a nightmare and not possible.
The Arduino+(Ethernet or WiFi) can send email, and the (RaspberryPi or BeagleBone) can do the same, but for very different versions of "can". Arduino+Ethernet provides a computing platform and hardware interface that could be used by email software like an SMTP client -- all you'd have to provide is the SMTP client :?

RaspberryPi or BeagleBone have full Linux releases available which include any mail software you need... once you've learned to control the software.

Not totally apropos, but before I knew about the Ethernet shield I did a presentation on low-level Internet access using a different card. If you get dug into doing access at that level you might be able to model your code on some of the code in the presentation: http://www.melwilsonsoftware.ca/wiz5100/

SMTP is one of the classic text-based Internet protocols, so you might get a start by cutting and pasting from the SMTP Transport Example code at Wikipedia: http://en.wikipedia.org/wiki/Simple_Mai ... r_Protocol


Good hunting, Mel.

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: what is the best device for sending email?

Post by Franklin97355 »

Also, if you are trying to send to Gmail Google requires SSL and so far I have not found an implementation that runs on an Arduino.

User avatar
brucef
 
Posts: 215
Joined: Tue May 03, 2011 4:51 pm

Re: what is the best device for sending email?

Post by brucef »

franklin97355 wrote:Also, if you are trying to send to Gmail Google requires SSL and so far I have not found an implementation that runs on an Arduino.
Hmm. Maybe if you want to send via Gmail you might require SSL, but to send to Gmail, you don't. There's a huge swath of SMTP infrastructure out there with no SSL support, and if Google didn't accept email from any of those systems, having a Gmail account would be pretty much useless.

If you have postfix or qmail or (heaven forbid) actual Sendmail on your Pi/Bone/whatever and you're using it to send mail, what happens is that your sendmail program accepts the message, looks up the MX record (via DNS) for the destination domain, connects to the server referenced in that MX record on port 25 (SMTP), and attempts to deliver the message. Your computer (the Pi) doesn't need to be configured for receiving mail, SSL, or anything else. If you can 'ping gmail.com' from a terminal prompt on your Pi, and if you have a sendmail-type mailer installed, you should be good to go.

metal693
 
Posts: 5
Joined: Tue Sep 03, 2013 10:59 pm

Re: what is the best device for sending email?

Post by metal693 »

ok, I did figure it out kind of. Basically using telnet commands. My email is a comcast smtp email and needed authorization. Also a little work is needed to setup the ip addresses etc. So I got it to send me a hard coded email that says button pressed. It will send an email to my metal@comcast account. But if I change the hardcoded email to my cell phone as a text message [email protected] I dont get any errors but I never get my text either. So Im much closer but still have a little ways to go. anyone else interested in this?

metal693
 
Posts: 5
Joined: Tue Sep 03, 2013 10:59 pm

Re: what is the best device for sending email?

Post by metal693 »

https://github.com/crmchenry3/Arduino_S ... ersion.ino

is the link where I got the code. I had to put in my own ip information and comcast information. it works but I still have something wrong. It just connects to the ethernet port, then email, authorization and everything, then it sends an email, quits and repeats forever. So I made a mistake somewhere.

I didnt write the code but I came across it when I was trying to learn how to send an email from telnet.

Thanks everyone for the help

User avatar
oldogtrik
 
Posts: 38
Joined: Sat May 25, 2013 6:53 pm

Re: what is the best device for sending email?

Post by oldogtrik »

I also am trying to decide which is a better platform to send an email from indicating an simple event such as "too hot" or "too cold". I have both a Raspberry Pi and an Arduino (with CC3000). Has the OP had any more success - or failure - sending email via the Arduino?

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”