Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

sending email using GPRS modem using AT commands

Status
Not open for further replies.

kirtan

Junior Member level 2
Joined
Mar 11, 2011
Messages
20
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,515
Hi
I am trying to send email through GPRS modem (SIM300) connected presently with serial port of PC and working on AT commands issued using hyper terminal.

I am able to connect to the smtp server of gmail. Once this is done it ask for STARTTLS before any command is issued. Once it issue this command server send me the message ready for TLS negotiation and then after when any command is sent, the connection is closed. Below are some of the efforts i have made using hyerterminal without success.

Kindly let me know how to do TLS negotiation and send an email. I have referred some of the threads on this forum, but could not get the direction. I am more an EC engg. know little less about the smtp protocols or way in which these server works....

kindly guide

at
OK
at+cmgf=1
OK
at+cscs="GSM"
OK
at+CGATT?
+CGATT: 1

OK
at+cipsrip=1
OK
at+cgdcont=1,"IP","portalnmms"
OK
at+cstt="portalnmms","",""
OK
at+ciicr
OK
at+cifsr
10.16.173.236
at+cipstatus
OK

STATE: IP STATUS
at+cdnsorip=0
OK
at+cipstart="TCP","74.125.115.109","25"
OK

CONNECT OK

RECV FROM:74.125.115.109:25
220 mx.google.com ESMTP e7sm2818994vdh.25
at+cipsend
> HELO smtp.gmail.com

SEND OK

RECV FROM:74.125.115.109:25
250 mx.google.com at your service
at+cipsend
> MAIL FROM:<mail@gmail.com>

SEND OK

RECV FROM:74.125.115.109:25
530 5.7.0 Must issue a STARTTLS command first. e7sm2818994vdh.25
at+cipsend
> STARTTLS

SEND OK

RECV FROM:74.125.115.109:25
220 2.0.0 Ready to start TLS

at+cipsend
> MAIL FROM:<vyasdd.diet@gmail.com>

SEND OK

CLOSED
----------------------------------

at+cipstart="TCP","74.125.115.109","25"
OK

CONNECT OK

RECV FROM:74.125.115.109:25
220 mx.google.com ESMTP ig8sm2864011vdb.3
at+cipstatus
OK

STATE: CONNECT OK
at+cipsend
> EHLO smtp.gmail.com

SEND OK

RECV FROM:74.125.115.1
250-mx.google.com at your service, [203.88.11.1]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250 PIPELINING
at+cipsend
> MAIL FROM:<vyasdd.diet@ gmail.com>

SEND OK

RECV FROM:74.125.115.109:25
530 5.7.0 Must issue a STARTTLS command first. ig8sm2864011vdb.3
at+cipsend
> STARTTLS

SEND OK

RECV FROM:74.125.115.109:25
220 2.0.0 Ready to start TLS
at+cipsend
> EHLO smtp.gmail.com

SEND OK

CLOSED
 

O

omar.nasir123

Guest
hey kirtan, i am also trying to do the same using SIM548c.Did you get something out of it?
 

s_guria

Member level 1
Joined
Dec 15, 2010
Messages
34
Helped
6
Reputation
12
Reaction score
3
Trophy points
1,288
Location
Ranchi/India
Activity points
1,490
TLS = Transport Layer Security
TLS is a protocol for secure SMTP session. SMTP itself is very simple protocol but not secure without encryption. nowadays most of the mail server requires TLS negotiation during SMTP session, including gmail.

steps for initiating SMTP/TLS
---------------------------
Connect to server using TCP
server replies with welcome message (un-encrypted)
send EHLO
server replies (un-encrypted)
send STARTTLS
server replies STARTTLS
client negotiates encryption method etc.(TLS stuff)
send EHLO (encrypted)
server replies EHLO (encrypted)
...(encrypted message continues...)
...

I don't know much details about TLS protocol but i guess it's not simple enough to use with terminal program, or 8 bit micros.
 
Last edited:

O

omar.nasir123

Guest
kindly tell me about some other method through which i can send an email using sim548c. please help me im really stuck at this point.
 

s_guria

Member level 1
Joined
Dec 15, 2010
Messages
34
Helped
6
Reputation
12
Reaction score
3
Trophy points
1,288
Location
Ranchi/India
Activity points
1,490
In fact kirtan was doing right, it only failed because of this TLS thing.

check out this thread https://www.edaboard.com/threads/196050/
Method on the above thread is absolutely correct. But if you try using gmail server, it will fail!! for the same reason.

Try using different mail server which supports un-encrypted SMTP. Many cheap web-hosts which provides shared hosting, still runs un-encrypted mail servers.

Personally I tried sending mail using Telit GSM module which has SMTP protocol stack, through gmail. it failed every time. But i had no problem sending mail using my webhosts mail server.
 

    V

    Points: 2
    Helpful Answer Positive Rating
O

omar.nasir123

Guest
okay thanks for the clarification. im basically building a tracker. ill feed coordinates from gps to microcontroller, and use the controller to initiate a gprs session using the module. i was hoping to send email containing coordinates but now that cant be done due to exclusion of TLS from the protocol stack of sim548c. I cannot use a public IP. is there any other way to send the coordinates?
 

s_guria

Member level 1
Joined
Dec 15, 2010
Messages
34
Helped
6
Reputation
12
Reaction score
3
Trophy points
1,288
Location
Ranchi/India
Activity points
1,490
Solution is HTTP protocol.
Use your PC as webserver. Host a page save.php or save.asp or whatever. write a code which saves data from HTTP GET method to the database.
Ex:-
save.php?lat=23.56363N&lon=45.88833E

For dynamic IP problem, use services like DynDns or NoIp. google it you will get details about configuration.
 

O

omar.nasir123

Guest
Can you elaborate on this? I have created a webserver and im using noip. What AT commands should i use to send my lat and long from microcontroller and what should i use to download these at server side?
 

parshant

Junior Member level 2
Joined
Jul 30, 2012
Messages
21
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,283
Activity points
1,405
Please tell me how can i send data to any of mail(yahoo) mail service with gsm module sim900D.
tell me what will be the details I am gonna use of mail service and what will be the algo or code...

Thanks
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top