alrighty, so I am trying to send an SMS via telnet to gmail, but i really have no idea what I am doing.
I am using this shield: http://www.cutedigi.com/wireless/wifi/linksprite-cuhead-wifi-shield-for-arduino.html
all of the sketches work fine. i've managed to connect the shield to the network.
Now onto executing telnet to gmail : I conceptually understand these guides on this process to connect illustrated here: Sending an email using gmail smtp server from telnet (using stunnel) in windows. – Tech & Dev Blog
and here is my attempt to fuse together somebodys ethernet shield example and the classes with the copperhead wifi shield. I have no clue what I am missing, what I need to consider, if anyone has working examples, what functions can be attached to this shields classes, etc. HELP.
/*
SEND AN EMAIL WITH ARDUINO
9/23/11
This code was created by modifying the connect example from arduino.cc
and with the help of the YABB forums and their very helpful members.
This code sends an email to any email address and then disconnects.
*/
#include <SPI.h>
#include <Ethernet.h>
#include <WiServer.h>
#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2
// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {192,168,1,2}; // IP address of WiShield
unsigned char gateway_ip[] = {192,168,1,1}; // router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0}; // subnet mask for the local network
const prog_char ssid[] PROGMEM = {"ASYNCLABS"}; // max 32 bytes
unsigned char security_type = 0; // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2
// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"12345678"}; // max 64 characters
// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, // Key 0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 1
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 2
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Key 3
};
// setup the wireless mode
// infrastructure - connect to AP
// adhoc - connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;
unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters ----------------------------------------
//byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // Arduino's artificial mac address
//byte ip[] = { 192, 168, 1, 1 }; // my ip
byte server[] = { 64,233,183,109 }; // my smtp.xxx.net server ip f gmail
Client client(server, 465);
void setup()
{
Ethernet.begin(local_ip, gateway_ip );
Serial.begin(57600);
Serial.println("connecting...");
if (client.connect()) {
Serial.println("connected");
client.println("HELO itismeletschat"); /* say hello (statement after helo is needed but irrelevant)*/
client.println("MAIL From: me@my-isp.net"); /* identify sender, this should be the same as the smtp server you are using */
client.println("RCPT To: you@your-isp.net"); /* identify recipient */
client.println("DATA");
client.println("To: you@your-isp.net"); /* identify recipient */
client.println("Subject: You Have Arduino Mail!!"); /* insert subject */
client.println("Please let me know it worked!!!"); /* insert body */
client.println("."); /* end email */
client.println("QUIT"); /* terminate connection */
client.println();
} else {
Serial.println("connection failed");
}
}
void loop()
{
delay(10000);
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}