Sim800l send file with attachment

Hi, I have seen different libraries for using SIM800L, (from Fona, SIM800L.h etc…), but It is still not clear to me which is the best way to send emails with attachments using SIM800L. Thanks to Ravi Blog, I reached out to send emails using a Hosting via terminal. but now I would like to send an email with attachments using an arduino uno. Does any one has any idea or example of this?.

Thanks
Angel

You can add attachment using AT+SMTPFILE command as shown in application note. You cant directly attach from memory , but they show you can enter the file contents byte by byte with lengths asked by the module after SMTPSEND command.

Thank you very much Ravi,

I just need to attach a TXT file. However as you mentioned i think it is necesary to send the content byte by byte. Do you have an example about how to do it, or the only information available is the SIM800L manual?, thanks for everything Ravi. (by now I am only using putty as terminal, however, i should start programming with arduino).

Best regards
Miguel

Hello Ravi,
I am very very new in this and need help for a project. Will appreciate If you like and you are able to help. Fof more details please send me an email at aldrm1@mail.com.

Thank you in advance
Neo

hi Ravi in my Journey for using arduino I reached to send sms and phone calls with arduino, however, for some reason when i try to send emails in the line smtp send the reply is error, Can you help me understand what is going on, please?

#include <SoftwareSerial.h>
//Create software serial object to communicate with SIM800L
SoftwareSerial mySerial(3, 2); //SIM800L Tx & Rx is connected to Arduino #3 & #2
void setup()
{
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
//Begin serial communication with Arduino and SIM800L
mySerial.begin(9600);

Serial.println(“Initializing…”);
delay(1000);
mySerial.println(" AT+SAPBR=3,1,“Contype”,“GPRS” “);
updateSerial();
mySerial.println(” AT+SAPBR=1,1 “); //
updateSerial();
mySerial.println(” AT+SAPBR=2,1 “); //
updateSerial();
mySerial.println(” AT+EMAILCID=1 “); //
updateSerial();
mySerial.println(” AT+EMAILTO=30 “); //
updateSerial();
mySerial.println(” AT+SMTPSRV=“mailXXXXXXXX”,25 “); // 25 587
updateSerial();
mySerial.println(” AT+SMTPAUTH=1,“test@XXXXXXXX”,“XXXX” “); //
updateSerial();
mySerial.println(” AT+SMTPRCPT=0,0,“XXXXXXXXXX”,“miguel” “); //
updateSerial();
mySerial.println(” AT+SMTPSUB=“test” “); //
updateSerial();
mySerial.println(” AT+SMTPBODY=19 “); //
updateSerial();
delay(100);
mySerial.print(”\n hello \n");
delay(1000);
mySerial.println(“AT+SMTPSEND”); //
updateSerial();
}
void loop()
{
}

void updateSerial()
{
delay(500);
while (Serial.available())
{
mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
}
while(mySerial.available())
{
Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
}
}

problem solved the lenght of the body should match with the smtpbody

1 Like