E-mailing data file

Richard Gaskin ambassador at fourthworld.com
Thu Aug 5 09:54:12 CDT 2010

Michael D Mays wrote:

 > In a lot of places email is the only way. I have people whose
 > parent corporation provides their internet connection. They
 > have limited bandwidth and a less than stellar corporate IT.
 > Emails of less than a few MB is the only way for them.

Unless I misunderstood the original request, this isn't a question of 
bandwidth but merely of finding a reliable way to send the message.

The mailto: protocol is often used for such things, and in many cases 
will open the user's default email client with a preformatted message 
ready to send.

The problem with mailto is that it's not reliable on Windows systems if 
there's any risk that the total URL string passed to it may exceed 512 
characters -- see the first comment at:

Complicating things further, this limit appears to vary between 
different versions of Windows and/or Outlook (I've seen some systems 
where lengths up to 2048 are accepted, but even that's kinda small for 
sending logs).

When that limit is exceeded, in most cases (but again, this is not 
consistently implemented) the OS will simply fail to open the client at all.

Faced with that unpredictable limit, mailto is only useful on Windows 
when you know the message will be very short.

So instead, we need to explore other options, and CGI is a great one.

With a CGI you use the same bandwidth, since the message isn't any 
longer regardless how it's sent.

But using a CGI to handle the message you no longer give up control over 
the message length, provided you send it with POST rather than GET 
(well, technically speaking some hosts may impose limits on POST data 
length, but usually those limits are so large they won't come into play 
for most common uses).

In fact, using a CGI you can send the same message in much a smaller 
data chunk using Rev's built-in gzip compression:

post compress(tMyData) to url "http://mydomain.com/cgi-bin/myscript.cgi"

Gzip compression works wonders on text, often reducing its length by as 
much as 40% and sometimes as high as 70% depending on the content.

On the receiving end, the CGI script can get the POST data, run it 
through Rev's decompress function, and either email it to you, or write 
it to a file you can pick up with FTP, or any number of other options.

  Richard Gaskin
  Fourth World
  Rev training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com
  revJournal blog: http://revjournal.com/blog.irv

More information about the use-livecode mailing list