Dokumentaro de Gambaso
Compilation & Installation
Components
Documents
Indekso de Lingvo
Language Overviews
LeguMin
Lexicon
Registro

How to Create and Open a ".gmail.txt" Archive

As you may know, GMail prevents sending and receiving e-mails with compressed attachments containing certain source code that triggers its "malicious code" filter. For this reason there is a method in the Gambas IDE to compress and uncompress source packages into text (.txt) format.

When we want to create a package like this so as to get past GMail's filters, we create the package as usual Project > Create > Source Package... Except before we click on the OK button, we will have the foresight to check Transform into a ".gmail.txt" archive that fools GMail. After creating the archive in this manner, we can attach the file with confidence knowing that our email should get delivered.

But then how do we open such a transformed file in the IDE?

Do not try to uncompress or unzip the ".gmail.txt" file with a command-line utility such as gzip or tar. It won't work.

We simply use the Select a Project > Open tab window that we get from the menu or the Open Project button (File > Open Project...). Both normally archived files and these special text files appear on the left side of the window. To open the ".gmail.txt" file, just right-click on it and choose Uncompress the file. This operation must be repeated twice: the first turns the text archive into a normal compressed file, the second unzips it so it can be opened in the IDE.

With a few extra steps, this same method can be used when we encounter one of these files attached in the Mailing List archives.

Let's take a practical example with this archived email with an attached special text archive:
https://lists.gambas-basic.org/pipermail/user/2022-January/075136.html

The archive is enclosed within <salt > and </salt> tags. It is necessary to select it all including the tags, copy & paste it into a text editor, and save it with any basename you wish, without spaces, but with an extension of ".tar.gz.gmail.txt". If you do not give it that exact extension, Gambas will not recognize it as a special ".gmail.txt" archive.

Then you can navigate to this file within the IDE and unpack it (twice) as usual.

Working with ".gmail.txt" files with an older version of Gambas

If you do not have a recent version of Gambas, the IDE will not be able to do what is said above. In that case, to unpack the file, use the following shell command on the command line:
S=[filename_to_convert]; D=$(basename $S .gmail.txt); head -n -1 $S | tail -n +2 | base64 -d > $D
Note: Quotations marks around the filename are required if it contains spaces.

There is a utility on the Gambas Software Farm that allows you to both pack and unpack these types of compressed files. Just do a search on the Farm for "gmail-attachment-pipe".