Click here to Skip to main content
15,891,708 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have sim 900 mini module with arduino uno. now i want send gmail using arduino only using at commands? how i do this. pls hep me

this is my code

C++
#include <softwareserial.h>

SoftwareSerial mySerial(10, 11); // RX, TX
bool ack=0;

void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  mySerial.println("Hello, world?");
  
}

void loop() // run over and over
{
 email();
  if (Serial.available())
    mySerial.write(Serial.read());
}


void email(){
  
  
  if(ack==0){
 mySerial.print("AT\r");
 bk();
delay(1000); 

 //mySerial.print("AT+SAPBR=4,1\r");
 bk();
delay(1000); 


 mySerial.print("\r");
 mySerial.print("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"\r");
 bk();
delay(1000); 




 mySerial.print("AT+SAPBR=3,1,\"APN\",\"ppwap\"\r");
 bk();
delay(1000); 

 mySerial.print("AT+SAPBR=3,1,\"USER\",\"\"\r");
 bk();
delay(1000); 

 mySerial.print("AT+SAPBR=3,1,\"PWD\",\"\"\r");
 bk();
delay(1000); 


 mySerial.print("AT+SAPBR=1,1\r");
 bk();
delay(1000); 



 mySerial.print("AT+SAPBR=2,1\r");
 bk();
delay(5000); 


 mySerial.print("AT+EMAILCID=1\r");
 bk();
delay(1000); 


 mySerial.print("AT+EMAILTO=120\r");
 bk();
delay(1000); 


 mySerial.print("AT+SMTPSRV=\"mail.yahoo.com\",587\r");
 bk();
delay(1000); 


 
 //mySerial.print("AT+SMTPAUTH=1,amal.wickramasinghe@yahoo.com,amal991\r");

 mySerial.print("AT+SMTPAUTH=1,\"amaal.wickramasinghe@yahoo.com\",\"amal1991\"\r");
 bk();
delay(1000); 

mySerial.print("AT+SMTPAUTH?\r"),
  bk();
delay(2000); 

mySerial.print("AT+SMTPFROM=\"amal.wickramasinghe@yahoo.com\",\"Andres-GPRS\"\r");
 bk();
delay(1000); 

 


mySerial.println("AT+SMTPRCPT=0,0,\"amalanjula@gmail.com\",\"andres\"\r");
 bk();
delay(1000); 


mySerial.print("AT+SMTPSUB=\"TEST_GPRS\"\r");
 bk();
delay(1000); 


mySerial.print("AT+SMTPBODY\r");
 bk();
delay(1000); 


mySerial.print("CUERPO DEL E-MAIL\r");
 bk();
delay(1000); 

 mySerial.write(0x1A);
    delay(1000);
    
    

mySerial.print("AT+SMTPSEND\r");
 //delay(20000); 
 while(1){
   
   bk();
 }
 
 
delay(20000); 
 bk();
delay(20000); 

ack=1;
}



  
}


void bk(){
   while (mySerial.available())
    Serial.write(mySerial.read());
  
}



this is last reply
SMTPSEND 65

its mean
"SMTP server response error "
Posted
Updated 15-Jul-15 22:04pm
v3
Comments
Member 15103062 16-Mar-21 20:16pm    
Hi,

Do you have the definitive solution?
I need the solution for my final proyect of university.

1 solution

You'd probably have to post your question on arduino or, better, SIM900 specific forums in order to get help. The SIM900 is really a strange beast.
 
Share this answer
 
Comments
Member 15103062 16-Mar-21 20:15pm    
Hi,

Do you have the defitive solution?
I need the solution for my final proyect of university...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900