本文介绍了如何使用sim 900分钟发送gmail的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有带有arduino uno的sim 900 mini模块。现在我想使用arduino只使用at命令发送gmail?我是怎么做到的请帮我



这是我的代码



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

#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,[email protected],amal991\r");

 mySerial.print("AT+SMTPAUTH=1,\"[email protected]\",\"amal1991\"\r");
 bk();
delay(1000);

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

mySerial.print("AT+SMTPFROM=\"[email protected]\",\"Andres-GPRS\"\r");
 bk();
delay(1000);




mySerial.println("AT+SMTPRCPT=0,0,\"[email protected]\",\"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 "

推荐答案


这篇关于如何使用sim 900分钟发送gmail的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 10:26