Sending an e-mail with Arduino - Page 1
Forum section: electronics / general

author: JoeAtl30319
author_rank: Contributor
timestamp: May 26, 2012, 07:10:42 pm
content: 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!

author: PA0PBZ
author_rank: Super Contributor
timestamp: May 26, 2012, 09:00:33 pm
content: 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.

author: Psi
author_rank: Super Contributor
timestamp: May 26, 2012, 11:25:18 pm
content: 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.

author: typeglob
author_rank: Contributor
timestamp: May 27, 2012, 12:46:15 am
content: Quote from: Psi on May 26, 2012, 11:25:18 pmIf 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.

author: johnboxall
author_rank: Unknown
timestamp: May 27, 2012, 07:32:41 am
content: Quote from: JoeAtl30319 on May 26, 2012, 07:10:42 pmCheck this thread out -http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1250101892

author: Psi
author_rank: Super Contributor
timestamp: May 27, 2012, 01:54:39 pm
content: Yeah i got the port wrong. I mean the secure smtp port. 465 i thinkSome isps only allow that.

author: typeglob
author_rank: Contributor
timestamp: May 27, 2012, 02:14:59 pm
content: Quote from: Psi on May 27, 2012, 01:54:39 pmWhat 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