mailto

FlexibleLearning at aol.com FlexibleLearning at aol.com
Mon Sep 22 14:36:01 EDT 2003


> Does anyone know the command to automatically send an email from the 
> command line I know the command (DOS):
> start mailto:pcollins at xsil.com?Subject=3Dtest

> will open up a mail with the word test in the subject section but does
> anyone know how to automatically send the email without human 
> intervention.
> 
> Regards
> Paul


This is a general purpose handler, for emailAddress, web pages or filePaths for both Mac (Classic and X) and PC (95, 98, NT, ME, W2k, XP) platforms.

on launchURL tURL,tClickChunk
  # tURL can be a local file path, a web URL or an eMail address.
  local tResult=""
  if ("@" is not in tURL) and ("www." is not in tURL) and (there is not a file tURL) then
    # Deal with 404 error...
    exit to top
  end if
  if (char 1 to 4 of tURL is "www.") then put "http://" before tURL
  else if (tURL contains "@" and "mailto:" is not in tURL) then put "mailto:" before tURL
  switch the platform
  case "MacOS"
    if "http://" is in tURL or "mailto:" is in tURL then
      send tURL to program "Finder" with "GURLGURL"
    else
      replace "/" with ":" in tURL
      if char 1 of tURL is ":" then delete char 1 of tURL
      put quote&"Finder"&quote into tApp
      put quote&tURL&quote into tURL
      put "tell application"&& tApp &cr&\
          "open file"&&tURL &cr&\
          "end tell" into tScript
      do tScript as AppleScript
      if "error" is in the result then put the result into tResult
    end if
    break
  case "Win32"
    set the hideConsoleWindows to true
    put empty into tApp
    if ("NT" is in the systemVersion) then
      set the shellCommand to "cmd.exe"
      put quote & quote into tApp
    end if
    get shell("start" && tApp && quote & tURL & quote)
    if the result is not empty then put the result into tResult
    break
  end switch
  if tResult is not empty then get smartAnswer("The following error is reported",tResult,"OK")
end launchURL

Hope you find this useful.

/H



More information about the use-livecode mailing list