Arduino Uno and sending email by Ethernet - Page 1
Forum section: electronics / general

author: PICmonster
author_rank: Regular Contributor
timestamp: March 30, 2015, 10:19:55 am
content: Dear AllI have looked into this over the past month and it seem that sending an email from an Arduino is not as easy as you first expect, I would like to know is I am missing any important information on how I can successfully send email from an Arduino via its Ethernet shield to ALL mail servers.I have come across Greylisting that regards all UN-official IP addresses as spam so bouncing the email, I have tried unsung Arduino to login into my email server and from there send the email, but the examples only work with some email servers not all.It seems clear that to use this for Alert messaging in a consumer device is plagued with problems unless a static IP is used, I am concluding a easier way is to use SMS Messaging.Any ideas how to use Ethernet to be able to send mail to any mail server via the Arduino, I know spammers would be the experts to ask but I am thinking this is not that easy for an end user to setup his/her email address to received this alert message.

author: sleemanj
author_rank: Super Contributor
timestamp: March 30, 2015, 12:36:21 pm
content: Read the smtp rfc, implement bare minimum for authenticated smtp client, point it to your relay server (isp outbound smtp), and away you go. Smtp is a simple protocol, authentication (plaintext) shouldn't add much complexity.

author: dtnicholls
author_rank: Contributor
timestamp: March 30, 2015, 01:04:29 pm
content: Google php email scripts, find a webhost that's really cheap (read:free) and host the php script on there.Then to send your email, send your email via POST to the php script and watch the magic... this saves trying to implement smtp and dealing with IP addresses etc etc.Lots and lots of info out there on how to send POST data to a script, and lots of info on connecting it to the internet.Good luck!

author: BradC
author_rank: Super Contributor
timestamp: March 30, 2015, 01:09:13 pm
content: Quote from: dtnicholls on March 30, 2015, 01:04:29 pmWTF are you on about?!? You still need to deal with an "IP" address to "POST" to a web script, and SMTP is *EASY*.. Like _so_ easy..Instead you recommend some complex, convoluted and probably horrifically insecure web based abortion?Read the RFC on SMTP. It's _so_ easy it's actually trivial. Makes doing a "POST" on a web form actually look complex.

author: daybyter
author_rank: Frequent Contributor
timestamp: March 30, 2015, 10:07:06 pm
content: What about the encryption?

author: BradC
author_rank: Super Contributor
timestamp: March 31, 2015, 12:48:02 am
content: Quote from: daybyter on March 30, 2015, 10:07:06 pmWhat encryption?

author: daybyter
author_rank: Frequent Contributor
timestamp: March 31, 2015, 02:49:43 am
content: It seems most SMTP servers here only accept encrypted SMTP.

author: Marco
author_rank: Super Contributor
timestamp: March 31, 2015, 03:25:10 am
content: Lots of ISPs don't allow outbound SMTP ... to be reliable e-mail has to go to through the user's ISP mail server, which adds an extra user configuration step.Why not setup a server somewhere which the UNO sends a message to via HTTP POST (most likely to be able to get out unscathed regardless of firewalls). The server can then send the email.

author: Stupid Beard
author_rank: Regular Contributor
timestamp: March 31, 2015, 04:09:36 am
content: Quote from: daybyter on March 31, 2015, 02:49:43 amRun an SMTP server on your local network that can only accept connections from your local network (or, better, just the IP address of your Arduino). Do not use encryption for this connection. Have said server setup as a relay to relay to whatever your downstream SMTP relay is, using appropriate encryption.The setup is pretty easy and is well within how SMTP was designed to operate. The HTTP based suggestions are not necessary and add complexity for no reason.

author: Nerull
author_rank: Frequent Contributor
timestamp: March 31, 2015, 04:34:44 am
content: Quote from: dtnicholls on March 30, 2015, 01:04:29 pmAnd go right into a hundred blacklists and spam folders. Which is likely to happen in any case - if you want to send email reliably, you'll need to jump through hoops. SMTP might be a simple protocol, but not getting caught in the crossfire of the spam war is not as easy. Do not expect mail from residential servers or cheap web hosts to get through, since spammers use them too.

author: westfw
author_rank: Super Contributor
timestamp: March 31, 2015, 05:28:21 am
content: The problem is that most ISP mail servers are pretty fussy about the "mail from:<xxx>" and perhaps headers, and perhaps don't accept unencrypted SMTP connections on port 25 any more (all spam and spam-sending-malware avoidance.) For example, Apple won't let me send email "from xxxx@yahoo.com" through their outgoing mail server...You can probably find a service that does accept such connections, perhaps with some registrations restrictions. Presumably your arduino isn't sending mail to large mailing lists or other destinations where blacklisting would be a major issues.You could also set up some sort of relay on a local PC. I hear "sendmail" is popular and easy to configure :-;

author: BradC
author_rank: Super Contributor
timestamp: March 31, 2015, 05:37:39 am
content: Quote from: PICmonster on March 30, 2015, 10:19:55 amThat's actually not greylisting. Greylisting is simply deferring unknown senders for a defined retry period or number of retries. This is because a large percentage of spam servers don't ever retry. It has _nothing_ to do with dynamic IP's.Additionally, servers that don't accept plain text SMTP are not SMTP servers. Encryption is optional. I run several mail servers, and I've _never_ had an issue with plain text SMTP. What I _have_ had an issue with is sending from an IP address without a valid reverse dns entry (and rightly so). In one case I maintain a cheap VPS with an SMTP server acting as a relay that I can bounce mail through so there is a valid reverse.Most ISP mail servers will rightly block an outbound mail that is not from one of their own domains, so you can't send brad@gmail.com through the outbound mail server for wasp.net.au as it want's to see brad@wasp.net.au. Again, nothing to do with the SMTP protocol but policy on behalf of the server owner.Sending SMTP from an embedded machine is not more difficult that sending it from anywhere else, your problems stem from trying to do things that most sane mail server admins rightfully block as spam (ie, not retrying when greylisted, sending from a dynamic IP where the reverse does not match any of the domains in the MX record or DNS entry). Again, I've _never_ struck a server that did not accept plain text SMTP. It *might* do that if you are trying to relay through it, but as a destination.. no.