Author Topic: Sending an e-mail with Arduino  (Read 20659 times)

0 Members and 1 Guest are viewing this topic.

Offline JoeAtl30319Topic starter

  • Contributor
  • Posts: 36
  • Country: us
Sending an e-mail with Arduino
« on: May 26, 2012, 07:10:42 pm »
Does anyone know how to send an e-mail with an Arduino and its Ethernet shield? If so, can you please post the code? Thanks!
 

Offline PA0PBZ

  • Super Contributor
  • ***
  • Posts: 5120
  • Country: nl
Re: Sending an e-mail with Arduino
« Reply #1 on: May 26, 2012, 09:00:33 pm »
Sending an email is basically just a telnet connection to port 25 of a mailserver, google for SMTP protocol.  Of course if you want to include error handling it might get a bit bigger than that.
Keyboard error: Press F1 to continue.
 

Online Psi

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: nz
Re: Sending an e-mail with Arduino
« Reply #2 on: May 26, 2012, 11:25:18 pm »
Yeah, as above.

You may have issues though if your ISP blocks port 25 SMTP.
Some ISPs require encrypted email communication on port ~993 and you wont be able to do that on an arduino.

If you can get port 25 access you should be able to send emails from the arduino quite easy once you understand the telnet commands. (its text based and quite simple)

It's likely that it will only work from your location though, most ISP block their email servers from the internet. So they can only be accessed by people on their network (the ISP's customers).
So if you took your finished product and plugged it into another network on a different ISP it may not work.

The way around that issue and the issue of encrypted mail servers might be to setup your own mail server on the network. You can then talk to that over port 25 and get it to forward the mail to over encrypted channels to wherever you want. You could then use a gmail address which would work from anywhere.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline typeglob

  • Contributor
  • Posts: 44
  • Country: nl
Re: Sending an e-mail with Arduino
« Reply #3 on: May 27, 2012, 12:46:15 am »
You may have issues though if your ISP blocks port 25 SMTP.
Some ISPs require encrypted email communication on port ~993 and you wont be able to do that on an arduino.
If the ISP does block outgoing mail (which I think they should), they likely have their own SMTP server you can use to relay the email. In a way this makes it even easier, since you can just connect to their email server for every email you want to send and leave it up to their SMTP server to relay it to the correct next hop (saves you from having to send DNS queries from your AVR).

Port 993 is IMAP over SSL - you can't submit email via IMAP. What some mail servers support however is storing a message via IMAP in your 'outbox', after which the mail server picks it up and sends it wherever it needs to go. If my provider forced me to do this, I would cancel my service and switch to another provider (after letting them know why they lost a customer).

There are also providers that require you to authenticate yourself (somewhat non-standard) before being allowed to submit email via SMTP or that require you to first set up a POP or IMAP connection, before you are allowed to connect to their SMTP server (port 'knocking'). In both cases they do this so they can see which customer it is that is trying to send an email.
 

Offline johnboxall

  • Supporter
  • ****
  • Posts: 652
  • Country: au
  • You do nothing, you get nothing.
    • Books, services and more:
Re: Sending an e-mail with Arduino
« Reply #4 on: May 27, 2012, 07:32:41 am »
Does anyone know how to send an e-mail with an Arduino and its Ethernet shield? If so, can you please post the code? Thanks!

Check this thread out - http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1250101892

Online Psi

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: nz
Re: Sending an e-mail with Arduino
« Reply #5 on: May 27, 2012, 01:54:39 pm »
Yeah i got the port wrong. I mean the secure smtp port. 465 i think
Some isps only allow that.
« Last Edit: May 27, 2012, 01:56:30 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline typeglob

  • Contributor
  • Posts: 44
  • Country: nl
Re: Sending an e-mail with Arduino
« Reply #6 on: May 27, 2012, 02:14:59 pm »
Yeah i got the port wrong. I mean the secure smtp port. 465 i think
Some isps only allow that.
What scared me a bit is that (via a hack if you ask me) it is actually possible to send mail via IMAP on some mail servers  ???
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf