Author Topic: Arduino Uno and sending email by Ethernet  (Read 6509 times)

0 Members and 1 Guest are viewing this topic.

Offline PICmonsterTopic starter

  • Regular Contributor
  • *
  • Posts: 63
  • Country: gb
Arduino Uno and sending email by Ethernet
« on: March 30, 2015, 10:19:55 am »
Dear All

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

 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3025
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: Arduino Uno and sending email by Ethernet
« Reply #1 on: March 30, 2015, 12:36:21 pm »
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.
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 

Offline dtnicholls

  • Contributor
  • Posts: 11
  • Country: au
Re: Arduino Uno and sending email by Ethernet
« Reply #2 on: March 30, 2015, 01:04:29 pm »
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!
 

Offline BradC

  • Super Contributor
  • ***
  • Posts: 2106
  • Country: au
Re: Arduino Uno and sending email by Ethernet
« Reply #3 on: March 30, 2015, 01:09:13 pm »
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.

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

Offline daybyter

  • Frequent Contributor
  • **
  • Posts: 397
  • Country: de
Re: Arduino Uno and sending email by Ethernet
« Reply #4 on: March 30, 2015, 10:07:06 pm »
What about the encryption?
 

Offline BradC

  • Super Contributor
  • ***
  • Posts: 2106
  • Country: au
Re: Arduino Uno and sending email by Ethernet
« Reply #5 on: March 31, 2015, 12:48:02 am »
What about the encryption?

What encryption?
 

Offline daybyter

  • Frequent Contributor
  • **
  • Posts: 397
  • Country: de
Re: Arduino Uno and sending email by Ethernet
« Reply #6 on: March 31, 2015, 02:49:43 am »
It seems most SMTP servers here only accept encrypted SMTP.
 

Online Marco

  • Super Contributor
  • ***
  • Posts: 6723
  • Country: nl
Re: Arduino Uno and sending email by Ethernet
« Reply #7 on: March 31, 2015, 03:25:10 am »
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.
« Last Edit: March 31, 2015, 03:27:47 am by Marco »
 

Offline Stupid Beard

  • Regular Contributor
  • *
  • Posts: 221
  • Country: gb
Re: Arduino Uno and sending email by Ethernet
« Reply #8 on: March 31, 2015, 04:09:36 am »
It seems most SMTP servers here only accept encrypted SMTP.

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

Offline Nerull

  • Frequent Contributor
  • **
  • Posts: 694
Re: Arduino Uno and sending email by Ethernet
« Reply #9 on: March 31, 2015, 04:34:44 am »
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!

And 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.
« Last Edit: March 31, 2015, 04:37:45 am by Nerull »
 

Online westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Arduino Uno and sending email by Ethernet
« Reply #10 on: March 31, 2015, 05:28:21 am »
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 :-;
 

Offline BradC

  • Super Contributor
  • ***
  • Posts: 2106
  • Country: au
Re: Arduino Uno and sending email by Ethernet
« Reply #11 on: March 31, 2015, 05:37:39 am »

I have come across Greylisting that regards all UN-official IP addresses as spam so bouncing the email,

That'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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf