I'm sending an email using Arduino Mega2560 with ethernet shield but I'm receiving and error after "sending". The error is :
Email Sent
220 BLU0-SMTP174.phx.gbl Microsoft ESMTP MAIL Service, Version: 6.0.3790.4675 ready at Fri, 4 May 2012 19:05:14 -0700
501 5.5.4 Invalid Address
530 5.7.0 Must issue a STARTTLS command first
501 5.5.4 Invalid Address
530 5.7.0 Must issue a STARTTLS command first
To send email to a destination address other than Hotmail, you must authenticate with your user and password, but it requires Transport Layer Security (TLS) to do that. The ethernet shield library has no TLS capability.
I have to authenticate the user name and password from the sending or receiving email?
I took other examples program that says it works,then there is no way I could send an email to either hotmail to hotmail, gmail to gmail or combined?
There is a way to make ethernet shield compatible with TLS?
edit: My apology in advance for any typos. I had to edit out my settings. I just returned from surfing and I need to get some surf wax and something to eat now.
530 5.7.0 Must issue a STARTTLS command first. i7sm19636491ani.17
That is asking you to start TLS, but you can't. There must be something about your email addresses that is not correct. I am on a different computer now. Give me a second and I will try the code and post my output.
I used the same code and server/port with my gmail account, and here is the output
Ready
connected
220 mx.google.com ESMTP e5si4439592anh.161
250 mx.google.com at your service
250 2.1.0 OK e5si4439592anh.161
250 2.1.5 OK e5si4439592anh.161
354 Go ahead e5si4439592anh.161
250 2.0.0 OK 1336249314 e5si4439592anh.161
221 2.0.0 closing connection e5si4439592anh.161
disconnected
Email sent
...and DING! My Blackberry says there is email in my Gmail account.
edit: By the place it asked for that TLS on your attempt, it must not like your FROM email address or your ip address.
Does your ISP have an email server you can send through? It may take email from the ips in its "localnet".
Where the server sent that 530 response is after the Arduino code sent the FROM email address. It had not even told the server what email address you wanted to send to. It didn't get that far.
That is why I use this code. That is normally the response if you use port 465 or 587, not port 25. You left the port set to 25 correct? Let me break it down.
220 mx.google.com ESMTP e5si4439592anh.161
// You send helo
250 mx.google.com at your service
// You send "MAIL From:". Here is where the 503 error was returned on yours.
250 2.1.0 OK e5si4439592anh.161
// You send "RCPT To:"
250 2.1.5 OK e5si4439592anh.161
// You send "DATA"
354 Go ahead e5si4439592anh.161
// You send the email with those to, from, and subject sends
// with a period on its own line as the terminator
250 2.0.0 OK 1336249314 e5si4439592anh.161
// You send "QUIT"
221 2.0.0 closing connection e5si4439592anh.161
// You client.stop()
disconnected
Email sent
Yes I use the port 25. So the problem can be in the port that I'm using? Because if the email is a real email form gmail and don't recognizes maybe is the port or the ip server. I'm using in command prompt ping smtp.gmail.com .
You do not have a connection problem. All looks good until you send the "MAIL From:". That is when you are getting the 530 error about the TLS. You are getting an error message from the server. There is no connection problem. It is a ip/spam blocker/protocol challenge.
Maybe you should use nslookup and see if there is another gmail email server ip for your area. It should be the MX entry.
My bad. It is a bit complex. From a command prompt
nslookup
set query=any
gmail.com
You should see a list of "MX preference = X mail exchanger = servername". Find the lowest number. Then below that is a list of those servernames with the ip of each.
It will only send TO gmail email addresses. The only real limitation to the FROM address is the domain (the part after the @) must be a valid domain name.
If you want to send to users in other domains, use the same procedures (including nslookup) to send to those domains.
FYI: Despite how it may appear, I am not a spammer. I know email servers.
edit: This is closer to an email server than an email client. It works like Sendmail or PostFix, not Outlook or Thunderbird.
Thanks. It appears I just can't connect to gmail. If I enter "(client.connect("smtp.gmail.com",25)" I get a connection but refused because it's expecting TLS.
Output from Arduino:
connected
220 mx.google.com ESMTP nt7sm7991698pbb.33
250 mx.google.com at your service
530 5.7.0 Must issue a STARTTLS command first. nt7sm7991698pbb.33
221 2.0.0 closing connection nt7sm7991698pbb.33
Looking for a bypass IP nslookup gives me this:
Server: 208.67.222.222
Address: 208.67.222.222#53
And finally the list of IPs that didn't connect from Arduino code:
// gmail.com email server
// IPAddress server( 74, 125, 65, 27 );
// IPAddress server( 74, 125, 224, 150 );
IPAddress server( 208, 67, 222, 222);
// IPAddress server(10, 64, 41, 98);
// IPAddress server( 74, 125, 224, 118);
EthernetClient client;
So . . . My goal is to have an Arduino watching our basic little concrete place in Costa Rica and email me if there is a problem with the power or alarm. (wonderful surfing nearby) This gmail approach might be too unreliable to let just sit for months. I have a small website with a submit form that would email me if I can get the Arduino to emulate the "post". It has lots of codes and IDs but if I could capture the post string it would be an alternative.
Is gmail likely to change IPs even if I find one that works? Other suggestions would be very appreciated.