Home
About
Agents
CGIs
Mac
Macros
Misc
Stories
Suites
Websites
Outline
Frontier
Scripting

tcp.sendMail

Here's a new verb, tcp.sendMail, that will be included with 5.0.2 if it checks out.

As you might imagine, it can be used to send electronic mail messages from Frontier scripts.

It's a simplified version of tcpcmd.sendMail, and was written and documented by Alan German, asg@erols.com, the author of tcpcmd.

We wanted a simpler version of sendMail to include with the built-in tcp verbs in Frontier 5, one that would serve as good sample code, and might evolve independently from the much richer tcpcmd functionality. Here it is!

How to install

  1. First, open the Quick Script window and enter something like this:

    user.prefs.mailHost = "mail.yourServiceProvider.com"

    This is the same setting you probably have in your email client software, for the host you send email thru.

    Click on the Run button in the Quick Script window.

  2. Load in the script object from this fat page. You can close the window, after browsing thru the script, if you're interested to see how it works.

  3. Control-S to save the changes to your database. (Cmd-S on Mac.)

Try an experiment

Again, in the Quick Script window, type:

tcp.sendMail (recipient:user.prefs.mailaddress, subject:"Hello!", message:"I can send lots of mail now.")

Click on the Run button.

Switch into your mail program, and check your mail.

Tech notes

All the parameters are strings, and they are all optional.

Here's a list of the parameters and their default values:

hostuser.prefs.mailHost
senderuser.prefs.mailAddress
recipient(empty string)
cc(empty string)
bcc(empty string)
subject(empty string)
message(empty string)
mimeType"text/plain"

recipient, cc, and bcc must be strings of a single email address or comma-delimited email addresses.

There is absolutely no error checking on the messages returned from the host. If your host is alive, and your parameters are clean, you won't have a problem.

Please

Please don't use this script to find new ways to spam people. Be kind. Remember the golden rule! Thanks.

Also, if you want more, be sure to check out the all-time classic, tcpcmd, from Alan's website.

Dave Winer
2/28/98

Sunday, March 01, 1998 at 8:43:33 AM by DW

Added code to replace lines that are just a single period with two periods per Jim Correia's suggestion.

Changed the parameter order to: recipient, subject, message, sender, cc, bcc, host, mimeType.


This is a fat web page containing tcp.sendMail. More info on fat pages here.

© copyright 1997-98 UserLand Software. This page was originally posted on 3/1/98; 7:27:53 AM and it was last built on 9/11/98; 9:23:15 AM. Webmaster: dave@userland.com.