This article is about showing you how to send a email using SIM900 GSM/GPRS module. SIM900 GSM module provides a set of AT commands which can be used for sending email via SMTP protocol to the web server through a GPRS connection. 

Watch this video if you want to see the live demo,

 

Before you begin make sure your SIM900 GSM module has acquired the network and it is ringing when you make a call to it. Then test the basic AT commands and then proceed further.

Once you are ready, you can start by first setting up the GPRS connection as follows, 


Text in RED is typed by me and text in GREEN is the response from SIM900 module.

 Setting up GPRS connection

Set the connection type to GPRS

AT+SAPBR=3,1,"Contype","GPRS"

OK

 

Set the APN to to "www" since i am using a Vodafone SIM card, It might be different for you, and depends on the network

AT+SAPBR=3,1,"APN","www"

OK

 

Enable the GPRS

AT+SAPBR =1,1

OK

 

Query if the connection is setup properly, if we get back a IP address then we can proceed

AT+SAPBR=2,1

+SAPBR: 1,1,"100.120.204.132"

OK

 


Sending a email to using SMTP protocol

Here in this demonstration i will be using email account NON SSL settings and credentials i got from my web server cPanel as shown below,

 

Before we begin we need to have the following information for sending email using SIM900 module.

 

 

Start by setting up the Email bearer profile identifier

AT+EMAILCID=1

OK

 

Set the timeout value within which you will enter the email data to be sent, Here i have set it to 30 seconds

AT+EMAILTO=30

OK

 

Set the SMTP server address and port number

AT+SMTPSRV="mail.marsinnovations.in",25

OK

 

Set the email authentication information 

AT+SMTPAUTH=1,"This email address is being protected from spambots. You need JavaScript enabled to view it.","pass123"

 OK

 

Set the senders email address and Name

AT+SMTPFROM="This email address is being protected from spambots. You need JavaScript enabled to view it.","Test"

OK

 

Set the To email address and Name

 

AT+SMTPRCPT=0,0,"This email address is being protected from spambots. You need JavaScript enabled to view it.","Ravi"

OK

 

Set the Cc email address and Name

 

AT+SMTPRCPT=1,0,"This email address is being protected from spambots. You need JavaScript enabled to view it.","Ravi"

 

OK

 

Set the Bcc email address and Name

 

AT+SMTPRCPT=2,0,"This email address is being protected from spambots. You need JavaScript enabled to view it.","Ravi"

 

 

OK

 

Set the email Subject, You can set whatever you want. I have set it as MySubject

AT+SMTPSUB="MySubject"

 

OK

 

Time to enter the email content. Enter the below command and you will get a > prompt after which you should type content and press Ctrl+Z when you are done or send 0x1A hex character.

AT+SMTPBODY 

> Hello Ravi How are you..fgbmklbgk....

 

OK

 

Send the email by entering the below command, if you get  the URC +SMTPSEND: 1 then email is successfully sent

AT+SMTPSEND

 

OK

+SMTPSEND: 1

 

Now check your receiver email Inbox and you should find the email with text "Hello Ravi How are you..fgbmklbgk...."  

Hope it helps someone. 

 

Also see:




About the Author

is the author of this blog and is an Embedded systems design engineer by profession & Founder @ Valetron Systems Pvt Ltd


Email:This email address is being protected from spambots. You need JavaScript enabled to view it.

Find us on Google+

HIRE ME FOR YOUR PROJECT AS A FREELANCER

 

EasyEDA: Free Circuit Design Software

  • Easy Schematic Capture
  • Powerful Circuit Simulation
  • Online PCB design

Design Your Circuit and PCB here:

https://easyeda.com/editor

Cheap PCB Manufacturing