Electronic – AT-Commands: Send E-mail with attachment

at commandspicsd

I purchased a telit GSM Click (GL865) to use in my project. The architecture is composed of PIC based board with two MikroBUS connectors, I used one for the Telit GSM click, and the second one for the SD card.

I interfaced the Telit GSM Click correctly.
I interfaced the SD card correctly.

I can read and write files to the SD card from within the Pic.
I issue successfully the AT commands to Send SMS and to Send E-mails.

The goal: Send e-mail with attachment, via telit GSM CLIK GL865.

The problem: I can't send e-mail with attached file.
I tried to provide filename to the command, it works without Error, but the received e-mail does not contain the file sent by the Telit modem, in contrast, I get an empty file with the same filename.

Example:

  • AT#SMTPCL=\"myaddress@mymail.com\",\"testEmail\",1,\"test.txt\",0
  • then I issue my text (email body)
  • then I issue the escape sequence ("+++")

Where: test.txt is a text file (containing some text) and stored in the SD card.

The command above works fine, I receive the e-mail (containing email body text) with an empty file "test.txt"

I think that the AT Command fails in finding the file, then it will send an empty file with the same filename.

I think that there is a way to import the file to be used by the Telit modem and the AT commands.

I read the official Telit documentation and searched in the Internet, but I did not find any solution.
I would like to seek your valuable support, and tell me please, how to get it to work, I will be very thankful.

Best Answer

According to the manual, section 5.1.6.10.9. Send mail with attachment - #SMTPCL:

AT#SMTPCL=<da>,<subj>,<att>[,<filename>,<encod>]

This command permits to send an email with different types of attachments if GPRS context has already been activated (#SGACT or #GPRS). After sending message body text (as with #EMAILD), the command switch to online mode if attachment has to be sent. While in online mode data received on the serial port are transmitted on the SMTP socket as MIME attachment. The escape sequence has to be sent to close the SMTP connection

In other words, YOU are responsible for sending the content of the attached file, after you send the body of the email message.