Send picture over gprs, smtp, softwareSerial, received damaged!!?
Posted: Mon Nov 25, 2019 8:27 pm
ello everyone, I have a problem:
I am trying to send an email attachment with a gsm sim800l module.
I use the AT command, the gmail SMTP server and the softwareSerial lib.
everything is ok, I can send emails, sms, read an html page, send emails with a .txt file as an attachment...
but when I want to send a picture as an attachment, it arrives but degrade : the half of the photo is in good condition but the rest is broken.
the photo is stored in SPIFFS memory, its weight: 1220 bytes, but after transferring his weight: 1235 bytes:
the doc of the sim module says: "AT + SMTPFILE"
first parameter: 2 = binary file
second parameter: <fileName>
third parameter: 1 = "base64"
I'm stuck, I tried a lot of different things but the picture is still broken ...
I think the problem is maybe the way to send bytes, but I can not do it?
thank you in advance to all those who can help me.
I am trying to send an email attachment with a gsm sim800l module.
I use the AT command, the gmail SMTP server and the softwareSerial lib.
everything is ok, I can send emails, sms, read an html page, send emails with a .txt file as an attachment...
but when I want to send a picture as an attachment, it arrives but degrade : the half of the photo is in good condition but the rest is broken.
the photo is stored in SPIFFS memory, its weight: 1220 bytes, but after transferring his weight: 1235 bytes:
the doc of the sim module says: "AT + SMTPFILE"
first parameter: 2 = binary file
second parameter: <fileName>
third parameter: 1 = "base64"
Code: Select all
...
sim800l.print("AT+SMTPFILE=2,\"photo.jpg\",1\r");
...
AT+SMTPFT=1220\r"
...
File file = SPIFFS.open(path_file_attachment);
if(!file)
{
Serial.println("// failed to open file for reading");
}
Serial.println("// read file from spiffs and send...");
while(file.available()>0)
{
sim800l.write(file.read());
}
file.close();
sim800l.print("\"");
...
I think the problem is maybe the way to send bytes, but I can not do it?
thank you in advance to all those who can help me.