Arduino Wifi Shield Port Issue

I posted this in programming, but that was probably the wrong location. The long and short of it is ISP’s are commonly blocking port 25, so I need to use port 26 (or other more common smtp ports). I’ve verified port 26 responds (and sends an email) using telnet, but calling port 26 says no connection.

if(client.connect(server,26)) {

Sketch:

//    Email client sketch for IDE v1.0.3 and Ethernet Shield
//    Posted December 2012 by SurferTim
//    Modified 17 March 2013 for WiFi Shield by 
//    MisterResistor and SurferTim


/*  THIS ONE WORKS!  Output below is from Serial Monitor
    Ready. Press 'e' to send.
connected
220 mail.yourmailserver.com ESMTP Sendmail 8.13.6/8.13.1; Sun, 17 Mar 2013 12:59:58 +0000
Sending helo
250 mail.yourmailserver.com Hello [38.123.84.242], pleased to meet you
Sending From
250 2.1.0 <me@mine.com>... Sender ok
Sending To
250 2.1.5 <you@mine.com>... Recipient ok
Sending DATA
354 Enter mail, end with "." on a line by itself
Sending email
250 2.0.0 r2HCxwgc027560 Message accepted for delivery
Sending QUIT
221 2.0.0 mail.yourmailserver.com closing connection
disconnected
Email sent


*/
/******************************************************/

//#include <SPI.h>
#include <WiFi.h>

// Setup on a 128 bit WEP network, change to suit for WPA

char ssid[] = "insert ssid";      //  your network SSID (name) 
char pass[] = "insert password";   // your network password


char server[] = "insert mail server name";  // smtp mail server  (mine.com)

int status = WL_IDLE_STATUS;

WiFiClient client;

void setup()
 {
 Serial.begin(9600);
 pinMode(9,OUTPUT);          // changed to use onboard LED
 digitalWrite(9,HIGH);
 WiFi.begin(ssid, keyIndex, pass); 

 }

void loop()
 {
   byte inChar;
   inChar = Serial.read();

  if(inChar == 'e')
   {
       if(sendEmail()) Serial.println("Email sent");     
       else Serial.println("Email failed");
   }       
 }

byte sendEmail()
 {
   byte thisByte = 0;
   byte respCode;

  if(client.connect(server,25)) {
     Serial.println("connected");
   } else {
     Serial.println("connection failed");
     return 0;
   }

  if(!eRcv()) return 0;
   Serial.println("Sending helo");

// change to your public ip
   client.write("helo 1.2.3.4\r\n");

  if(!eRcv()) return 0;
   Serial.println("Sending From");

// change to your email address (sender)
   client.write("MAIL From: <insert email address>\r\n");

  if(!eRcv()) return 0;

// change to recipient address
   Serial.println("Sending To");
   client.write("RCPT To: <insert email address>\r\n");

  if(!eRcv()) return 0;

  Serial.println("Sending DATA");
   client.write("DATA\r\n");

  if(!eRcv()) return 0;

  Serial.println("Sending email");

// change to recipient address
   client.write("To: Name <insert email address>\r\n");

// change to your address
   client.write("From: Arduino <insert email address>\r\n");

  client.write("Subject: Arduino email test\r\n");
  client.write("This is from my Arduino WiFi shield!\r\n");
  client.write(".\r\n");

  if(!eRcv()) return 0;

  Serial.println("Sending QUIT");
  client.write("QUIT\r\n");

  if(!eRcv()) return 0;

  client.stop();

  Serial.println("disconnected");

  return 1;
 }

byte eRcv()
{
  byte respCode;
  byte thisByte;
  int loopCount = 0;

  while(!client.available()) {
    delay(1);
    loopCount++;

    // if nothing received for 10 seconds, timeout
    if(loopCount > 10000) {
      client.stop();
      Serial.println("\r\nTimeout");
      return 0;
    }
  }

  respCode = client.peek();

  while(client.available())
   {  
     thisByte = client.read();    
     Serial.write(thisByte);
   }

  if(respCode >= '4')
   {
     efail();
     return 0;  
   }

  return 1;
 }

void efail()
{
  byte thisByte = 0;
  int loopCount = 0;

  client.write("QUIT\r\n");

  while(!client.available()) {
    delay(1);
    loopCount++;

    // if nothing received for 10 seconds, timeout
    if(loopCount > 10000) {
      client.stop();
      Serial.println("\r\nTimeout");
      return;
    }
  }

  while(client.available())
  {  
    thisByte = client.read();    
    Serial.write(thisByte);
  }

  client.stop();

  Serial.println("disconnected");
}

Have you upgraded the firmware? Have you tried connecting to any other server?

Have not upgraded firmware (brand new wifi card - rev3). I've tried SMTP2GO and Hostgator. Both are accessible by way of telnet (SMTP2GO didn't actually deliver the email, Hostgator did) on ports other than 25. ports other than 25 do not seem to work in the arduino sketch.

Search the forum for firmwareversion. It displays what firmware version you have on your shield. It must be v1.1.0

It was 1.0.0

I upgraded, and now Get wifi shield not found. Grrrrr.

See WiFiClient port numbers? - Programming Questions - Arduino Forum

I apologize for having two threads, but wasn't sure if it was a programming issue or a networking issue.

Should we take all the disussion over to the other thread, or point that discussion here?

Insure you remove the DFU programming jumper on the wifi shield.

Yes, jumper is removed. I have a solid blue data light, but "No wifi shield found".

I moved the two files to my root directory. Here is my post about the upgrade.

I used c:\wifitemp\

But other than that, did the same. Still have solid blue data light, and "Wifi shield not found" ...

You used the two upgrade files included with the Arduino IDE v1.0.5?

The only trouble I had with the upgrade was the Atmel upgrade software finding the files. Once I got a clean upgrade on both files, it worked fine. You did upgrade both files, right?

edit: I did panic at first when I forgot to remove the programming jumper. :blush:

Yes two clean files from the firmware directory of 1.0.5

there's two of the wifi_dnld.elf files, but have the same size and date. January 2014.

I have only one wifi_dnld.elf and one wifiHD.elf file in my IDE download, but if they are the same, it shouldn't make a difference. You are using a R3 Uno, correct? The previous versions need a jumper from 5v to ioref.

There's one in wifishield/wifi_dnld/Release and one in wifishield/binary.

I am using a R3 UNO, and was connecting to the Internet previous to the upgrade.

I’m sure I used the one in Release. You are using IDE v1.0.5 now, right? Other than that, I don’t know what to tell you. I haven’t heard of anyone else that had problems except for the one problem of the Atmel upgrade software finding the upgrade files, and removing the programming jumper. ??

You are sure the shield and the Arduino are connected correctly to each other?

I am using 1.0.5. The shield is sitting solidly in place, all the pins are straight and in correct positions. jumper is removed (was set during programming). Both files uploaded correctly from c:\wifitemp\

C:\Program Files (x86)\Atmel\Flip 3.4.7\bin>batchisp.exe -device AT32UC3A1512 -h
ardware usb -operation erase f memory flash blankcheck loadbuffer c:\wifitemp\wi
fiHD.elf program verify start reset 0
Running batchisp 1.2.5 on Sun Jun 08 09:50:56 2014

AT32UC3A1512 - USB - USB/DFU

Device selection....................... PASS
Hardware selection..................... PASS
Opening port........................... PASS
Reading Bootloader version............. PASS 1.0.2
Erasing................................ PASS
Selecting FLASH........................ PASS
Blank checking......................... PASS 0x00000 0x7ffff
Parsing ELF file....................... PASS c:\wifitemp\wifiHD.elf
WARNING: The user program and the bootloader overlap!
Programming memory..................... PASS 0x00000 0x3fe2b
Verifying memory....................... PASS 0x00000 0x3fe2b
Starting Application................... PASS RESET 0

Summary: Total 11 Passed 11 Failed 0

C:\Program Files (x86)\Atmel\Flip 3.4.7\bin>batchisp.exe -device AT32UC3A1512 -h
ardware usb -operation erase f memory flash blankcheck loadbuffer c:\wifitemp\wi
fi_dnld.elf program verify start reset 0
Running batchisp 1.2.5 on Sun Jun 08 09:51:37 2014

AT32UC3A1512 - USB - USB/DFU

Device selection....................... PASS
Hardware selection..................... PASS
Opening port........................... PASS
Reading Bootloader version............. PASS 1.0.2
Erasing................................ PASS
Selecting FLASH........................ PASS
Blank checking......................... PASS 0x00000 0x7ffff
Parsing ELF file....................... PASS c:\wifitemp\wifi_dnld.elf
WARNING: The user program and the bootloader overlap!
Programming memory..................... PASS 0x00000 0x2902b
Verifying memory....................... PASS 0x00000 0x2902b
Starting Application................... PASS RESET 0

Summary: Total 11 Passed 11 Failed 0

C:\Program Files (x86)\Atmel\Flip 3.4.7\bin>

Just a thought before I walk down to check the surf...Do you have a SD card in the shield's slot?

No SD card.