Let' suppose you want to send with your embedded device an EMAIL by using a SMTP server.
Server to be contacted: smtp.gsm-modem.de
Application Layer Protocol: SMTP (RFC821)
Sender: "JOHN SMITH"<John.Smith@gsm-modem.de>
Subject: Email Test
Message body: this message is sent for test Easy GPRS feature. Hello World!
IP of GPRS device: dynamically assigned by the network
DNS: assigned by the network
USERID: Happy User
PASSWORD: EASY GPRS
Checking on the RFC990 the SMTP service we can found that the port 25 is dedicated for SMTP service, therefore our SMTP server will be waiting for incoming connections on that port and we will fix the EASY GPRS port to be contacted on the remote server exactly to 25. Second thing we have to discover is whether the transport protocol has to be TCP or UDP; on the RFC821 we can read that the SMTP Application layer protocol is meant to be on top of TCP/IP protocol, therefore the transport protocol choice will fall on TCP.
Now we have all the information needed to configure our system. With our micro controller we issue to the JOHN SMITH the following AT commands:
AT+CGDCONT = 1,"IP","internet.gprs","0.0.0.0",0,0<cr> (1-GPRS context setting)
AT#USERID = "Happy User"<cr> (2-Authentication setting)
AT#PASSW = "EASY GPRS"<cr> (2-Authentication setting)
AT#SKTSET= 0,25,"smtp.gsm-modem.de"<cr>(3-remote host setting)
For our convenience we store all these parameters with the command:
Now we can activate the GPRS connection and let the JOHN SMITH module contact the server:
When we receive the CONNECT indication, then we are exchanging data with the SMTP server program on the remote host machine.Now following the SMTP protocol we proceed with the HELLO presentation and mail delivery directly over the serial line (in green the data sent by us, in violet the one received from host):
220 smtp.gsm-modem.de ESMTP ; Thu, 5 Jun 2003 14:45:11 +0200
250 smtp.gsm-modem.de Hello [126.96.36.199], pleased to meet you
MAIL FROM: "JOHN SMITH"<John.Smith@gsm-modem.de><cr><lf>
250 2.1.0 "JOHN SMITH"<John.Smith@gsm-modem.de>... Sender ok
RCPT TO: "Receiver"<firstname.lastname@example.org><cr><lf>
250 2.1.5 " John.Smith@gsm-modem.de "... Recipient ok
354 Enter mail, end with "." on a line by itself
From: "JOHN SMITH"<John.Smith@gsm-modem.de><cr><lf>
Subject: Email Test<cr><lf>
This message is sent for testing Easy GPRS feature. Hello World!<cr><lf>
250 2.0.0 h55CjBVI020859 Message accepted for delivery
DONE! Easy as EASY GPRS.