SIM900 Email via gprs
void Bearer_profile (void)
{
Server_Actv = 1;
GSM("AT+SAPBR=2,1"); // test connection ?
_delay_ms(400);
if(!APMSTS) //if not connected . connect now!
{
GSM("AT+CREG?");
_delay_ms(50);
GSM("AT+SAPBR=4,1");
_delay_ms(400);
GSM("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");
_delay_ms(50);
GSM("AT+SAPBR=3,1,\"APN\",\"claro.com.br\"");
_delay_ms(50);
GSM("AT+SAPBR=3,1,\"USER\",\"claro\"");
_delay_ms(50);
GSM("AT+SAPBR=3,1,\"PWD\",\"claro\"");
_delay_ms(50);
GSM("AT+SAPBR=1,1");
_delay_ms(4500);
}
GSM("AT+SAPBR=2,1");
_delay_ms(2000);
Server_Actv = 0;
}
void send_email_via_yahoo (void)
{
Server_Actv = 1;
GSM("AT+EMAILCID=1");
_delay_ms(100);
GSM("AT+EMAILTO=20"); //time out 20...120 sec //resp ok
_delay_ms(100);
GSM("AT+SMTPSRV=\"smtp.mail.yahoo.com.ar\",587"); //resp ok
_delay_ms(100);
GSM("AT+SMTPAUTH=1,\"GPRS.123456789@yahoo.com.ar\",\"*********\""); //resp ok
_delay_ms(100); // sender mail key
GSM("AT+SMTPFROM=\"gprs.123456789@yahoo.com.ar\",\"Andres-GPRS\""); //resp ok
_delay_ms(100);
GSM("AT+SMTPRCPT=0,0,\"abcdefghijk@gmail.com\",\"andres\""); //resp ok
_delay_ms(100); // to
GSM("AT+SMTPSUB=\"TEST_GPRS\""); //resp ok
_delay_ms(100);
P_ROMT = 0;
USART0_TX ("AT+SMTPBODY"); //resp ok
GSM("AT+SMTPBODY");
while(!P_ROMT){_delay_ms(50);} // sistem promp .... ? >>
GSM("CUERPO DEL E-MAIL. enviado por GPRS modem a 17 min de intervalo ");
GSM(" ");
GSM(" ");
_delay_ms(10);
GSM_BYTE(0x1A); // transact end
_delay_ms(100);
GSM("AT+SMTPSEND"); // send this
SMTPSEND_OK = 0;
for (int time=0;time<=31 ;time++)
{
_delay_ms(1000); // time out for send +1
}
Server_Actv = 0;
}
Suscribirse a:
Entradas (Atom)