create.post <- function(instructions = "\\n",
                        description = "post",
                        subject = "",
                        ccaddress = Sys.getenv("USER"),
                        method = getOption("mailer"),
                        address = "the relevant mailing list",
                        file = "R.post")
{
    body <- paste(instructions,
		  "--please do not edit the information below--\\n\\n",
		  "Version:\\n ",
		  paste(names(version), version, sep=" = ", collapse="\\n "),
                  "\\n\\n",
                  win.version(),
		  "\\n\\n",
                  "Locale:\\n",
                  Sys.getlocale(),
		  "\\n\\n",
		  "Search Path:\\n ",
		  paste(search(), collapse=", "),
		  "\\n", sep="", collapse="")

    if (method == "none") {
        disclaimer <-
            paste("# R for Windows will not send your ", description,
                  " automatically.\n",
                  "# Please copy the ", description, " (after finishing it) to\n",
                  "# your favorite email program and send it to\n#\n",
                  "#       ", address, "\n#\n",
                  "######################################################\n",
                  "\n\n", sep = "")

        cat(disclaimer, file=file)
        body <- gsub("\\\\n", "\n", body)
        cat(body, file=file, append=TRUE)
        file.edit(file)
        cat("The unsent", description, "can be found in file",
            tools::file_path_as_absolute(file), "\n")
    }
    else if (method == "mailto") {
        if (missing(subject)) stop("'subject' missing")
        if (nchar(subject) < 1) subject <- "<<Enter Meaningful Subject>>"

	body <- gsub("\\\\n", "%0A", body)
        cat("The", description, "is being opened for you to edit and send.\n")
	mail <- try(shell(paste("start \"title\" \"mailto:", address,
                                "?subject=", subject, "&body=", body,
                                sep = "")))
        if (inherits(mail, "try-error")) {
            body <- gsub("%0A", "\n", body)
            cat(body, file=file, append=TRUE)
            file.edit(file)
            cat("The unsent", description, "can be found in file",
                tools::file_path_as_absolute(file), "\n")
        }

    }
    invisible()
}

win.version <- function() .Internal(win.version())