Anybody seen an email client built upon the Arduino WiFi shield?

I got you started in the playground. Your user/password for the forum works there. http://playground.arduino.cc/Code/WiFiEmailClient

If you have trouble, I'll help.

edit: You can find it in the playground under "User Code Library - Snippets and sketches - WiFi". If I don't see it by tomorrow, I'll put it in there for ya. :)

Hi, I am trying to connect my arduino wifi shield with the hotspot created by my phone. I used the code posted above but it is not working for me. The code gives me the following errors when i run the code...

Ready. Press 'e' to send.
connected
220 mx.google.com ESMTP cy4sm2248846pbc.13 - gsmtp
Sending helo
250 mx.google.com at your service
Sending From
530 5.7.0 Must issue a STARTTLS command first. cy4sm2248846pbc.13 - gsmtp
221 2.0.0 closing connection cy4sm2248846pbc.13 - gsmtp
disconnected
Email failed

I am trying to connect with my gmail account, i got the ip address of the phone from this website "whatismyip.com" but i am not sure what should i put as the gateway and subnet. I am using "smtp.gmail.com" as my server and port 25. Can anyone please help with this. Thank you

This tells me you are not connecting on port 25. You cannot start TLS.

530 5.7.0 Must issue a STARTTLS command first. cy4sm2248846pbc.13 - gsmtp

@Learning: Good job on the playground code.

Thank you SurferTim for the reply. So i changed the port number to 465 (I just Google "gmail port"). so it prints this on the serial monitor...

Ready. Press 'e' to send.
connected

Use port 25. This software works like an email server (like Sendmail or PostFix) sending email to another email server, not like an email client (like Outlook or Thunderbird) sending email to an email server.

edit: This is a bit confusing. Sometimes the gmail server for other email servers to send email to gmail accounts is not the same as the email server you use as a client. You should use nslookup to determine the gmail email server for your area and use that domain name. There may be several email servers listed. Use the server with the lowest preference number. They will be called mail exchangers (MX).

Sorry Tim, I am kinda confused. Can you please explain what do u mean by that. thank you

nslookup is a network utility to resolve domain names to ip addresses, and sometimes one domain name to a servername. From a command prompt:

nslookup
set query=mx
gmail.com

If you use Windows, you may need to go to your control panel and install the network utilities in "Add/Delete Programs" section to use this. It is not hard to do.

Thank you Tim for the guidance, it worked !!!

there are 3 config at outbound email sever site;-

  1. ip authentication. it is easy, basic server has arduino's ip in mynetwork. no authentication is needed at arduino.

  2. plan text authentication, arduino support it well. authentication code is needed at arduino.

  3. ssl/tls authentication. arduino does not support it, and never does. Gmail is the case.

smtps,https,ftps,sftp,imaps,pop3s... any things with s, no support at Arduino+ ethernet/wifi shield.

if u have to support them, then use resperry pi as ethernet/wifi shield for Arduino.

@husnalraikumar: You're welcome! @sonnyyu: You are correct.

This is an except from my nslookup with query=mx and gmail.com.

gmail.com MX preference = 30, mail exchanger = alt3.gmail-smtp-in.l.google.com gmail.com MX preference = 40, mail exchanger = alt4.gmail-smtp-in.l.google.com gmail.com MX preference = 5, mail exchanger = gmail-smtp-in.l.google.com gmail.com MX preference = 10, mail exchanger = alt1.gmail-smtp-in.l.google.com gmail.com MX preference = 20, mail exchanger = alt2.gmail-smtp-in.l.google.com

I use MX perference = 5 gmail-smtp-in.l.google.com Your's may be different.

Does this code has a Limitation of just sending emails from the same account like we can only send emails from one gmail account to another ?
or can we send emails from gmail to live/yahoo/webmailmail accounts too?
thank you

husnalraikumar: Does this code has a Limitation of just sending emails from the same account like we can only send emails from one gmail account to another ? or can we send emails from gmail to live/yahoo/webmailmail accounts too? thank you

You can send email to users in the domain of the email server. If you nslookup gmail.com, you can send to about any existing user that has a gmail account, as in user@gmail.com. If you want to send to a user@yahoo.com for example, you would need to nslookup yahoo.com to find the mail exchanger that will take email for yahoo.com.

The only check of the sender email address I ever see (besides the ip range by companies like Spamhaus) is the domain of the sender must be valid. If that is malformed or does not resolve, the email server may reject your email.

edit: I forgot to mention one annoying feature about these commercial email servers like gmail. They will only take so many emails per hour to the same destination address (and it isn't that many), then they will start rejecting your email temporarily, up to a few hours. It is actually a "not now, come back later" message. :(

Thanks Tim for the reply. The code was working fine till yesterday. Now when i try to upload the code to my arduino it gets stuck at the uploading point and it gives lots of time out errors. can anyone help me with that? Thank you

Does it start the upload and stall after a few kb? Or doesn't upload anything?

Insure you have selected the correct port and board in the IDE. On some version bootloaders, the upload will stall if you have "!!!" in your code somewhere, like this:

Serial.println("It works!!!");

Tim you made my day !! that was the problem!! Thanks Man.. really appreciated that.