TLG10AU03 UART wifi module smtp gmail and setup issues, counterfeit PL2303

Hi I just received a TLG10AU03 wifi uart server client module http://www.ebay.com/itm/UART-WiFi-Server-Client-Module-Kits-Arduino-Compatible-with-shield-for-Arduino-/130766449058?ssPageName=ADME:X:AAQ:US:1123 and have got it all set up finally and serving a webpage. A word of warning to anybody who buys one of these at the end of this post.
I got the one with the Elechouse arduino shield and PL2303 usb serial interface. I am trying to work out how to send a smtp email via smtp.gmail.com and / or sms using the TLG10AU03. I can do it with a python script using pyserial on a serial attached pc without the wifi module but would like the arduino to be independent of a pc. I have googled this all day and to no avail. It is hopefully a silly question with a simple solution. All I have found so far relates to ethernet shields and arduino wifi shields, both of which use specific libraries to connect. Any help would be greatly appreciated.
Warning: there are counterfeit PL2303 modules and I am sure that mine is one of them. It will give an error code 10 but only when the wifi module is connected, something to do with power from the extensive googling that I did trying to resolve it. I eventually emailed the supplier asking what the problem could be and they confirmed that the PL2303 was not supplying enough current for the module and to connect it through the wifi shield. As the documentation is so bad it was another major procedure to get that setup to work. There are jumpers on the shield that select whether rx and tx connect to the pc or to the arduino. The jumpers have to be parallel to the pc indication to program the wifi module and parallel to arduino to communicate with the avr directly. What they do not mention in the documentation is that it is almost impossible to connect to the wifi module with the atmega328 on the uno board (god knows what to do if it is surface mounted AVR) but removing it allows immediate connection using the UART wifi utility. The unit can then be configured preferably with static ip. Once again the documentation is your worst enemy as the "hello world" sketch that they supply simply does not work and they also tell you not to enable auto work mode, in which case you will be able to access to webconfig but not serve a site, to do that you have to enable auto work mode in the webconfig page, set port etc . I hope the below sketch saves others from the stress and waste of time that I have gone through so far with this (nb your serial port must be set to 115200 in device manager and you must set jumpers on shield to arduino and remove wifi module from shield when uploading sketch, module takes at least 10 seconds to connect to network.):

//Arduino sketch for serial wifi module
//To upload this to the arduino first disconnect the wifi module
//The wifi module must first be configured through the uart wifi utility and set to autowork mode through the webconfig page of the module
//If using the Elechouse wifi shield ensure jumpers are parallel to the text "arduino" on the pcb
//If using arduino and shield to program wifi module remove the avr microprocessor from the arduino,
//it makes it much easier to connect through serial, also set jumpers on shield parallel to the text "pc" on the pcb and check baud rate on serial
//and in uart wifi client set to 115200
//If using power supply other than usb 5volts be aware that over 6 volts will make the arduino very hot around the voltage regulator 
void setup()
{
  Serial.begin(115200);//make sure serial port of arduino is set to same and wifi module set to same through uart wifi configuration utility
}
void loop()
{
  boolean currentLineIsBlank = true;
  while(1){ //run forever
    if (Serial.available()) {//this checks output from wifi module, it takes up to ten seconds to initialise and join wifi network, this must be allowed for in some applications
      char c = Serial.read();//initialise variable for serial out from wifi module

      if (c == 'n' && currentLineIsBlank)//when a http request is recieved this tests for end of message before reply with sending webpage
      {
        // send acknowledgement
        Serial.println("HTTP/1.1 200 OK");
        Serial.println("Content-Type: text/html");
        Serial.println("Connection: close");
        Serial.println();
        // send web page
        Serial.println("<!DOCTYPE html>");
        Serial.println("<html>");
        Serial.println("<head>");
        Serial.println("<style>");
        Serial.println("h1 {color:red;}");
        Serial.println("p {color:blue;}");
        Serial.println("</style>");
        Serial.println("<title>Arduino</title>");
        Serial.println("</head>");
        Serial.println("<body><center>");
        Serial.println("<h1>");
        Serial.println("Hello World!
");
        Serial.println("</h1>");
        Serial.println("</center></body>");
        Serial.println("</html>");
        break;
        //the following code allows for new requests to be detected
      }
      if (c == 'n') {
        // you're starting a new line
        currentLineIsBlank = true;
      } 
      else if (c != 'r') {
        // you've gotten a character on the current line
        currentLineIsBlank = false;
      }
    }
  }
}


}

Read this:This is the procedure AT to get the TLG10UA03 on the WIFI Then on the Net - Networking, Protocols, and Devices - Arduino Forum

The sketch does not work because you are working on an Arduino mega 2560, and you are facing the "!!!" Problem. So the upload hang. Remove one ! Or update you bootloader And it should be ok.

Also if you work in auto mode you should put a delay of lower then 120 seconde time out other ways your browser will just wait for 2 minutes before showing any thing. But I agree the sketch stink. :wink:

Error code 10 is actually sent by your wifi module, that is why you only get this error when the module is hook on you pl2303 key. And it mean "Join fail" althouth the pl2303 does get hot when you hook the wifi module, it will never send any error message of any kind. It does not have what is required in it to send any error message.

Personnally, i don't use this kind of usb2serial any more cause it tend to become to hot, but it does the job still.

Make these changes to your code:
'n' to '\n' it is line feed.

'r' to '\r' it is carriage return.