s Computing: To Unix and Back (Alive)

Alternative Culture MagazineCougar WebWorks Celebrating Nature, Culture, and Spirit
Alternative Culture Magazine

Alternative Culture Blog


Further Adventures of a Rogue Journalist

by Nowick Gray, Editor of Alternative Culture Magazine

journal online

 


To UNIX and Back (Alive):

A Primer on Self-service Mailbots and Forms

Mailbots

Forms

I just got this far a moment ago and the power went out, blacking out my system and forcing me to start over. So it goes. A long day, beginning in the wee hours, in which I set out to master forms, cgi scripts, mailbots, aliases...in fact I've gotten sucked into a whirlpool of learning over the last three days, into the old-fashioned, arcane world of UNIX, the dreaded terminal interface.

I can't say I came out with mastery of it all, or even much competence; but I came back alive. In fact, I managed to cobble together a working mailbot along the way, and a half-dozen options for forms for my website. So, the decent thing to do is to share some of what I learned, by the grace of a few dark hours and the generosity of other computer fanatics who are evidently far more dedicated or stubborn or quick-minded than I.


Mailbots

Mailbots, or e-mail autoresponders, can be had from commercial servers for as little as ten bucks a month. They are useful for disseminating broad-range feelers about one's product or service or whatever, encouraging interested parties to click "reply" and then responding automatically with a longer text message. Spam for those who like the taste, why not. Marcia Yudkin had a little advice somewhere that I stashed aside about six months back, about designing and installing your own for free in ten minutes; so I dredged up her file and set to work. Three days and nights later...

Well it's a longer story because I've also been sitting on several dozen files and programs about forms--waiting to experiment with all this stuff until I got my recent local phone line. So now was the time. To make a long story short, it wasn't quite necessary to learn all of Perl, CGI, UNIX, Pine, Mail, etc. etc., but it did seem prudent to scan the topic well enough to be able to a) make the supposedly simple mailbot work and b) choose a good method of installing some forms to my website.

Trouble is, the cheap way usually costs time if not money. If you like spending the time, you're laughing. I guess I do. I think this whole computer business was invented to make ourselves feel clever when we figure some of it out. A gigantic, ever-complexifying puzzle, game, maze. At any rate, the mailbot: My server has provided me with a low-cost account and so can only afford scanty help for such tasks. I'm thankful they provide the facilities and a few tips. The facilities include a UNIX platform available via Telnet, a web host available via FTP, and some decent FAQ's. So I got some basics and here they are:

  1. Get a ready-made, simple mailbot script: mailbot.pl. It's written in Perl which doesn't have to be a problem except...
  2. You probably have to track down the location of the "sendmail" and "mail" directories on your server's UNIX system in order to get the values just right in the script.
  3. You need a way to activate it. In Marcia Yudkin's case, it was a "vacation" program on her UNIX server; in my case, it was creating a file called ".forward" that tells incoming mail to go to the mailbot program and to send your desired message text back out. All that happens in one line of the .forward file: with a couple of big ifs...
  4. The mailbot.pl script has to be installed in a personal cgi-bin directory. And the message.txt has to be in the right place. And, what was hanging me up for the longest time, the UNIX system has to be set to give these files and directories the proper "permissions" with a "chmod" command (mine worked with the value 755). And I thought I could make this summary short and sweet...
  5. The line in the .forward file has to be formatted correctly. I still haven't figured out the perfect way but what I finally did worked (somewhere between my server's generic description and the mailbot.pl's remarks about what to use).

As a side effect of all this I did become, let us say, passingly acquainted with UNIX and Perl, and it's funny, though I'm not going to spend time learning any more of it than I need to, I did kind of enjoy in a nostalgic way the direct computer-human relationship, something that was so magical at my first encounter in 1968 at Dartmouth's Kiewit Computing Center, where time-sharing through multiple terminals and the use of the programming language BASIC were pioneering concepts...

Where was I? Oh, yes,


Forms

Tired of all this plain text yet? Too bad, I haven't got around to Java or animated applets and plug-ins and shockwaves and web-bots and all, just yet. First the basics. My crash course in Perl and CGI scripts seemed like a bit of overkill when I had Microsoft Front Page sitting there with its web-bots waiting to take me down the yellow brick road to programless heaven. Somehow I didn't (still don't) trust the little buggers. This business about loading the "server extensions" up with my website...how much space will they take there, and how reliable? Well, the computer in my Toyota's doing a pretty good job so far...Where was I? Ah, the basics. Basically, it boils down to this:

  1. Spend a hundred bucks or two on Front Page and forget the rest (if you can).
  2. Buy a Professional Version of WebForms 2.1 (for $40) and forget the rest (if you can). This software will even process your data direct from the server, by handling your e-mail and sorting it into database tables.
  3. Use a ready-made CGI script like the one my server has in its main CGI-bin (it's called CGIemail) which will give your client immediate feedback after submitting the form and will send that feedback nicely formatted to your e-mail. The install procedure once again wasn't as straightforward as advertised: it took some experimenting to get the required message file in the right directory, with the right path, and the right permissions.
  4. The same thing can be done with any number of freely available CGI scripts floating around out there, though again to get the path statements and permissions right is critical. Just play with the directories and chmod values until it works. (It will work, in the end; that's the beauty of it all, that's why we stay up all night at this stuff, right, so at last we can smile and breathe and walk outdoors and go to our lonely mates and say, "I finally got it!")
  5. Finally (I discovered this one last, wading too far too fast out to the deep water) there's the simple way: just post your form (in the ACTION command) to your mailto: address. Now, simplicity comes with a small price: your mail message will have all the feedback from the form strung out in a single line with the good stuff all gummed up with three-symbol codes for punctuation and spacing. Fortunately there are solutions to apply at the home end of things to straighten this out and give you output that matches what the fancy Perl scripts do...
  6. Make a search-and-replace (read destroy) macro for your word-processor to change the garbage signs back to real punctuation and spacing. Details courtesy of Harry Sklar...
  7. Use a nifty little subroutine of a vast and truly intimidating DOS do-it-yourself programming machine called Parse-O-Matic. Another one of those zip files I tried nine months ago and put away for a long winter's night... Actually you don't even have to learn any of it, thanks to the add-on called CVTFREP.POM, which automates this one of a thousand functions you'll want Mr. POM to do for you. Again the output is neat and clean. Choose this if you don't want to get your hands dirty with macros; Go back one space if you don't want to sit at the same desktop with DOS.


The moral

Moral? Who said anything about...?

Well, I did save the $125./hr. (four-hour minimum) that my server's technicians would have charged for all this; or the monthly charges of a more full-service outfit. Sort of like, do you change your own oil and spark plugs?

--Funny, I've stopped doing that these last couple of years. At any rate, time to sign off now; gotta go make a big batch of tofu....


© Nowick Gray


journal online

Archive

Many of the essays appearing here are collected in convenient e-book format (pdf). Coming Home: Nature and Me and Other Essays is available now for free download.

Right-click to save to your computer: nature.pdf

Rule Reversals (January 2003)

Telling it Like it Is (January 2003)

White Rabbit (February 2002)

On Novelty (February 2002)

An Open Letter to the Democratic Party after September 11 (December 2001)

Psychoactive Sacramentals: Essays on Entheogens and Religion (book review) (November 2001)

Forest Storm (September 2001)

Feminism, Poetic Myth, and Alternative Culture - An Homage to The White Goddess (July 2000)

Quests for Identity and Other Addictions (May 2000)

Wheel of Fortune (April 2000)

Great Writers and Street Poets (February 2000)

Upgrade for Speed Because Time is Running Out? (August 1999)

Retail Therapy: Decision Making in the Computer Age (August 1999)

Retail Therapy2: Random Brief Downtimes (August 1999)

Farouche Speaks (April 1999)

NetGlut: Notes from a cleansing fast (February 1998)

To Unix and Back Alive (January 1997)

Webness (November 1996)

Surfing Again (November 1996)

Bananas in British Columbia (May 1996)

Confessions of a computer addict (May 1996)


About the Editor | Site Map | Homepage | Email | ©2006 Cougar WebWorks