sendmailR/0000755000176200001440000000000012407533547012202 5ustar liggesuserssendmailR/tests/0000755000176200001440000000000012407525457013345 5ustar liggesuserssendmailR/tests/multiple_recipients.R0000644000176200001440000000252412407525457017553 0ustar liggesuserslibrary("sendmailR") sendmail(from="from@example.org", to="to1@example.org", subject="foo", msg="bar", control=list(transport="debug")) sendmail(from="from@example.org", to=c("to1@example.org", "to2@example.org"), subject="foo", msg="bar", control=list(transport="debug")) sendmail(from="from@example.org", to=c("to1@example.org", "to2@example.org"), cc="cc1@example.org", subject="foo", msg="bar", control=list(transport="debug")) sendmail(from="from@example.org", to=c("to1@example.org", "to2@example.org"), cc="cc1@example.org", subject="foo", msg="bar", control=list(transport="debug")) sendmail(from="from@example.org", to="to1@example.org", cc=c("cc1@example.org", "cc2@example.org"), subject="foo", msg="bar", control=list(transport="debug")) sendmail(from="from@example.org", to="to1@example.org", bcc="bcc1@example.org", subject="foo", msg="bar", control=list(transport="debug")) sendmail(from="from@example.org", to="to1@example.org", bcc=c("bcc1@example.org", "bcc2@example.org"), subject="foo", msg="bar", control=list(transport="debug")) sendmailR/NAMESPACE0000644000176200001440000000053012407531607013412 0ustar liggesusers# Generated by roxygen2 (4.0.2): do not edit by hand S3method(mime_part,character) S3method(mime_part,data.frame) S3method(mime_part,default) S3method(mime_part,ggplot) S3method(mime_part,matrix) S3method(mime_part,trellis) export(mime_part) export(sendmail) export(sendmailOptions) export(sendmail_options) importFrom(base64enc,base64encode) sendmailR/R/0000755000176200001440000000000012407525457012404 5ustar liggesuserssendmailR/R/sendmailR.r0000644000176200001440000001421612407525457014511 0ustar liggesusers## ## sendmailR.r - send email from within R ## ## Author: ## Olaf Mersmann (OME) ## .rfc2822_date <- function(time=Sys.time()) { lc <- Sys.getlocale("LC_TIME") on.exit(Sys.setlocale("LC_TIME", lc)) Sys.setlocale("LC_TIME", "C") strftime(time, format="%a, %d %b %Y %H:%M:%S -0000", tz="UTC", use.tz=TRUE) } .get_recipients <- function(headers) { res <- headers$To if (!is.null(headers$Cc)) { res <- c(res, headers$Cc) } if (!is.null(headers$Bcc)) { res <- c(res, headers$Bcc) } res } .write_mail <- function(headers, msg, sock) { if (!is.list(msg)) msg <- list(msg) ## Generate MIME headers: boundary <- paste(packBits(sample(0:1, 256, TRUE)), collapse="") headers$`MIME-Version` <- "1.0" headers$`Content-Type` <- sprintf("multipart/mixed; boundary=\"%s\"", boundary) headers$To <- paste(headers$To, collapse=", ") if (!is.null(headers$Cc)) headers$Cc <- paste(headers$Cc, collapse=", ") ## Do not include BCC recipients in headers, after all, it is a ## _blind_ carbon-copy. headers$Bcc <- NULL writeLines(paste(names(headers), unlist(headers), sep=": "), sock, sep="\r\n") writeLines("", sock, sep="\r\n") writeLines("This is a message with multiple parts in MIME format.", sock, sep="\r\n") for (part in msg) { writeLines(sprintf("--%s", boundary), sock, sep="\r\n") if (inherits(part, "mime_part")) .write_mime_part(part, sock) else if (is.character(part)) { ## Legacy support for plain old string ## writeLines(sprintf("--%s", boundary), sock, sep="\r\n") writeLines("Content-Type: text/plain; format=flowed\r\n", sock, sep="\r\n") writeLines(part, sock, sep="\r\n") } } writeLines(sprintf("--%s--", boundary), sock, sep="\r\n") } .smtp_submit_mail <- function(server, port, headers, msg, verbose=FALSE) { stopifnot(is.character(headers$From)) wait_for <- function(lcode) { done <- FALSE while (!done) { line <- readLines(con=sock, n=1) if (verbose) message("<< ", line) code <- substring(line, 1, 3) msg <- substring(line, 5) if (code == lcode) { done <- TRUE } else { if (code >= 500 & code <= 599) stop("SMTP Error: ", msg) else message("Unknown SMTP code: ", code) } } return(list(code=code, msg=msg)) } send_command <- function(cmd, code) { if (verbose) message(">> ", cmd) writeLines(cmd, sock, sep="\r\n") wait_for(code) } nodename <- Sys.info()[4] sock <- socketConnection(host=server, port=port, blocking=TRUE) if (!isOpen(sock)) stop(sprintf("Could not connect to smtp server '%s' on port '%i'.", server, port)) on.exit(close(sock)) ## << 220 ESMTP wait_for(220) ## >> HELO localhost ## << 250 mail.statistik.uni-dortmund.de send_command(paste("HELO ", nodename), 250) ## >> MAIL FROM: ## << 250 2.1.0 Ok send_command(paste("MAIL FROM: ", headers$From), 250) ## >> RCPT TO: ## << 250 2.1.5 Ok recipients <- .get_recipients(headers) sapply(recipients, function(x) send_command(paste("RCPT TO: ", x), 250)) ## >> DATA ## << 354 blah fu send_command("DATA", 354) ## >> if (verbose) message(">> ") .write_mail(headers, msg, sock) writeLines(".", sock, sep="\r\n") wait_for(250) ## << 250 2.0.0 Ok: queued as XXXXXXXX ## >> QUIT ## << 221 2.0.0 Bye send_command("QUIT", 221) } ##' Simplistic sendmail utility for R. Uses SMTP to submit a message ##' to a local SMTP server. ##' ##' @title Send mail from within R ##' ##' @param from From whom the mail message is (RFC2822 style address). ##' @param to Recipient of the message (vector of valid RFC2822 style addresses). ##' @param cc Carbon-copy recipients (vector of valid RFC2822 style addresses). ##' @param bcc Blind carbon-copy recipients (vector of valid RFC2822 style addresses). ##' @param subject Subject line of message. ##' @param msg Body text of message or a list containing ##' \code{\link{mime_part}} objects. ##' @param \dots ... ##' @param headers Any other headers to include. ##' @param control List of SMTP server settings. Valid values are the ##' possible options for \code{\link{sendmail_options}}. ##' ##' @seealso \code{\link{mime_part}} for a way to add attachments. ##' @keywords utilities ##' ##' @examples ##' \dontrun{ ##' from <- sprintf("", Sys.info()[4]) ##' to <- "" ##' subject <- "Hello from R" ##' body <- list("It works!", mime_part(iris)) ##' sendmail(from, to, subject, body, ##' control=list(smtpServer="ASPMX.L.GOOGLE.COM")) ##' } ##' ##' @export sendmail <- function(from, to, subject, msg, cc, bcc, ..., headers=list(), control=list()) { ## Argument checks: stopifnot(is.list(headers), is.list(control)) if (length(from) != 1) stop("'from' must be a single address.") if (length(to) < 1) stop("'to' must contain at least one address.") get_value <- function(n, default="") { if (n %in% names(control)) { return(control[[n]]) } else if (n %in% names(.SendmailREnv$options)) { return(.SendmailREnv$options[[n]]) } else { return(default) } } headers$From <- from headers$To <- to if (!missing(cc)) headers$Cc <- cc if (!missing(bcc)) headers$Bcc <- bcc headers$Subject <- subject ## Add Date header if not explicitly set. This fixes the annoyance, ## that apparently Thunderbird does not sort mails correctly if they ## do not have a Date header. if (is.null(headers$Date)) headers$Date <- .rfc2822_date() transport <- get_value("transport", "smtp") verbose <- get_value("verbose", FALSE) if (transport == "smtp") { server <- get_value("smtpServer", "localhost") port <- get_value("smtpPort", 25) .smtp_submit_mail(server, port, headers, msg, verbose) } else if (transport == "debug") { message("Recipients: ", paste(.get_recipients(headers), collapse=", ")) .write_mail(headers, msg, stderr()) } } sendmailR/R/mime_part.R0000644000176200001440000001223712407525457014511 0ustar liggesusers.mime_part_finalizer <- function(x) { if (!is.null(x$file)) file.remove(x$file) } .mime_part <- function(headers, file=NULL, text=NULL) { if (!is.null(file) && !is.null(text)) stop("Can only provide file or text for mime part.") e <- environment() reg.finalizer(e, .mime_part_finalizer, onexit=TRUE) class(e) <- "mime_part" e } .write_mime_part <- function(mp, con=stdout()) { writeLines(paste(names(mp$headers), unlist(mp$headers), sep=": "), con, sep="\r\n") writeLines("", con, sep="\r\n") if (is.null(mp$file)) writeLines(mp$text, con) else writeLines(readLines(mp$file), con, sep="\r\n") } #' @importFrom base64enc base64encode .file_attachment <- function(fn, name, type="application/octet-stream", disposition="attachment") { if (missing(name)) name <- basename(fn) text <- base64encode(fn, linewidth=72, newline="\n") headers <- list("Content-Type"=type, "Content-Disposition"=sprintf("%s; filename=%s", disposition, name), "Content-Transfer-Encoding"="base64") .mime_part(headers=headers, text=text) } .plot_attachment <- function(plt, name=deparse(substitute(plt)), device, ...) { fn <- tempfile() device(file=fn, ...) print(plt) dev.off() ## FIXME: Guess content type from device! res <- .file_attachment(fn, name, type="application/pdf") file.remove(fn) res } ##' Create a MIME part ##' ##' @param x Object to include ##' @param name Name of mime part. Usually the filename of the ##' attachment as displayed by the e-mail client. ##' @param ... Possible further arguments for \code{mime_part} ##' implementations. ##' @return An S3 \code{mime_part} object. ##' @export mime_part <- function(x, name, ...) UseMethod("mime_part", x) ##' Default MIME part method ##' ##' Creates a string representation of the object \code{x} using ##' \code{dput}. This representation is then turned into a file ##' attachment. ##' ##' @param x R object ##' @param name Filename used for attachment (sans the .R extension) ##' @param ... Ignored. ##' @return An S3 \code{mime_part} object. ##' ##' @method mime_part default ##' @export mime_part.default <- function(x, name, ...) { str <- dput(x) .mime_part(headers=list( "Content-Type"="text/plain", "Content-Disposition"=sprintf("attachment; file=%s.R", name)), text=str) } ##' Creates a MIME part from a trellis plot object ##' ##' Writes a PDF file of the plot defined by \code{x} and turns this ##' PDF file into a file attachment. ##' ##' @param x A \code{trellis} (lattice) object ##' @param name Name of attachment (sans .pdf extension). ##' @param device Graphics device used to render the plot. Defaults to ##' \code{pdf}. ##' @param ... Ignored. ##' @return An S3 \code{mime_part} object. ##' ##' @method mime_part trellis ##' @export mime_part.trellis <- function(x, name=deparse(substitute(x)), device=pdf, ...) .plot_attachment(x, name=name, device=device, ...) ##' Creates a MIME part from a ggplot2 plot object ##' ##' Writes a PDF file of the plot defined by \code{x} and turns this ##' PDF file into a file attachment. ##' ##' @param x A \code{ggplot} object ##' @param name Name of attachment (sans .pdf extension). ##' @param device Graphics device used to render the plot. Defaults to ##' \code{pdf}. ##' @param ... Ignored. ##' @return An S3 \code{mime_part} object. ##' ##' @method mime_part ggplot ##' @export mime_part.ggplot <- function(x, name=deparse(substitute(x)), device=pdf, ...) .plot_attachment(x, name=name, device=device, ...) ##' Create a MIME part from a matrix. ##' ##' @param x Matrix ##' @param name Basename of file attachment that is generated. ##' @param ... Ignored. ##' @return An S3 \code{mime_part} object ##' ##' @method mime_part matrix ##' @export mime_part.matrix <- function(x, name=deparse(substitute(x)), ...) { f <- tempfile() on.exit(file.remove(f)) write.table(x, file=f, ...) .file_attachment(f, name=sprintf("%s.txt", name), type="text/plain") } ##' Create a MIME part from a \code{data.frame}. ##' ##' @param x A \code{data.frame}. ##' @param name Basename of file attachment that is generated. ##' @param ... Ignored. ##' @return An S3 \code{mime_part} object. ##' ##' @method mime_part data.frame ##' @export mime_part.data.frame <- function(x, name=deparse(substitute(x)), ...) { f <- tempfile() on.exit(file.remove(f)) write.table(x, file=f, ...) .file_attachment(f, name=sprintf("%s.txt", name), type="text/plain") } ##' Create a MIME part from a character string. If the string matches ##' a filename, a MIME part containing that file is returned instead. ##' ##' @param x Character string, possibly a filename. ##' @param name Name of attachment. ##' @param ... Ignored. ##' @return An S3 \code{mime_part} object. ##' ##' @method mime_part character ##' @export mime_part.character <- function(x, name, ...) { if (length(x) == 1 && file.exists(x)) { .file_attachment(x, name, ...) } else { .mime_part(headers=list( "Content-Type"="text/plain", "Content-Disposition"="inline"), text=paste(x, collapse="\r\n")) } } sendmailR/R/options.R0000644000176200001440000000417012407525457014224 0ustar liggesusers## Option managment shamelessly taken from the lattice package. .SendmailREnv <- new.env(parent=emptyenv()) .SendmailREnv$options <- list() .update_list <- function (x, val) { if (is.null(x)) x <- list() modifyList(x, val) } ##' Specify global sendmail options so that subsequent calls to ##' \code{sendmail()} do not have to set them in the \code{control} ##' argument. ##' ##' List of options: ##' \itemize{ ##' \item{smtpServer}{SMTP server to contact. This can either be the ##' mail server responsible for the destination addresses domain or a ##' smarthost provided by your ISP or institution. SMTP AUTH is ##' currently unsupported.} ##' \item{smtpPort}{SMTP port to use. Usually 25 but some institutions ##' require the use of the submission service (port 587).} ##' \item{verbose}{Show detailed information about message ##' submission. Useful for debugging.} ##' } ##' ##' @param ... Any options can be defined, using \code{name=value} or ##' by passing a list of such tagged values. However, only the ones ##' below are used in base sendmailR. ##' @return For \code{sendmail_options()}, a list of all set options ##' sorted by name. For \code{sendmail_options(name)}, a list of length ##' one containing the set value, or 'NULL' if it is unset. For uses ##' setting one or more options, a list with the previous values of ##' the options changed (returned invisibly). ##' ##' @title Set package specific options. ##' @export ##' @author Olaf Mersmann \email{olafm@@datensplitter.net} sendmail_options <- function(...) { new <- list(...) if (is.null(names(new)) && length(new) == 1 && is.list(new[[1]])) new <- new[[1]] old <- .SendmailREnv$options if (length(new) == 0) return(old) nm <- names(new) if (is.null(nm)) return(old[unlist(new)]) isNamed <- nm != "" if (any(!isNamed)) nm[!isNamed] <- unlist(new[!isNamed]) retVal <- old[nm] names(retVal) <- nm nm <- nm[isNamed] .SendmailREnv$options <- .update_list(old, new[nm]) invisible(retVal) } ##' @export ##' @rdname sendmail_options sendmailOptions <- function(...) { .Deprecated("sendmail_options") sendmail_options(...) } sendmailR/MD50000644000176200001440000000162112407533547012512 0ustar liggesuserse74ad00026a32eca7c5f929dd1d1cbcd *DESCRIPTION a7921b801f3b709c8fdba88a22fd59ca *NAMESPACE 63a69470d88af7d4696b7197f2d5efba *R/mime_part.R 856a6c04c7bb25abf3461c1e51a1ac02 *R/options.R 6b869c065653234b41ed1129dc74b8be *R/sendmailR.r f272d69dc7d9ee3f97a557cd4a41f05b *man/mime_part.Rd 735f27b8777aa851ff18eae2717a8eec *man/mime_part.character.Rd 377b9bdee9a96fcca0252ada27db46c2 *man/mime_part.data.frame.Rd e25d9fdd8ac1859a9f58fa61dc584d66 *man/mime_part.default.Rd f324fbfbc55b6d907a5eb6e3fad02afe *man/mime_part.ggplot.Rd 7882007acd3bb5b4a460fb438f203a75 *man/mime_part.matrix.Rd 3c9f103a3632439e15fbde0d7bff7ebe *man/mime_part.trellis.Rd 8520ef0e1339c4916a1a6cb6eb5eb914 *man/sendmail.Rd b537d2c41ba5fb5a5cbe0ae173539795 *man/sendmail_options.Rd ea77ad180ba762b7b3cd98782e63c7a9 *tests/multiple_recipients.R b4d0955b0317e090a5fe4007f00723a5 *tools/roxygenize 4bead2dc52a0fdf30832c1477ceb1ee2 *tools/set-version sendmailR/DESCRIPTION0000644000176200001440000000121112407533547013703 0ustar liggesusersPackage: sendmailR Version: 1.2-1 Title: send email using R Description: Package contains a simple SMTP client which provides a portable solution for sending email, including attachment, from within R. Authors@R: c(person("Olaf", "Mersmann", role=c("aut", "cre"), email="olafm@p-value.net"), person("Quinn", "Weber", role="ctb")) Depends: R (>= 3.0.0) Imports: base64enc License: GPL-2 LazyData: yes Packaged: 2014-09-21 11:16:23 UTC; olafm Author: Olaf Mersmann [aut, cre], Quinn Weber [ctb] Maintainer: Olaf Mersmann NeedsCompilation: no Repository: CRAN Date/Publication: 2014-09-21 13:32:55 sendmailR/man/0000755000176200001440000000000012407531607012750 5ustar liggesuserssendmailR/man/sendmail_options.Rd0000644000176200001440000000255712407531607016617 0ustar liggesusers% Generated by roxygen2 (4.0.2): do not edit by hand \name{sendmail_options} \alias{sendmailOptions} \alias{sendmail_options} \title{Set package specific options.} \usage{ sendmail_options(...) sendmailOptions(...) } \arguments{ \item{...}{Any options can be defined, using \code{name=value} or by passing a list of such tagged values. However, only the ones below are used in base sendmailR.} } \value{ For \code{sendmail_options()}, a list of all set options sorted by name. For \code{sendmail_options(name)}, a list of length one containing the set value, or 'NULL' if it is unset. For uses setting one or more options, a list with the previous values of the options changed (returned invisibly). } \description{ Specify global sendmail options so that subsequent calls to \code{sendmail()} do not have to set them in the \code{control} argument. } \details{ List of options: \itemize{ \item{smtpServer}{SMTP server to contact. This can either be the mail server responsible for the destination addresses domain or a smarthost provided by your ISP or institution. SMTP AUTH is currently unsupported.} \item{smtpPort}{SMTP port to use. Usually 25 but some institutions require the use of the submission service (port 587).} \item{verbose}{Show detailed information about message submission. Useful for debugging.} } } \author{ Olaf Mersmann \email{olafm@datensplitter.net} } sendmailR/man/mime_part.ggplot.Rd0000644000176200001440000000114312407531607016506 0ustar liggesusers% Generated by roxygen2 (4.0.2): do not edit by hand \name{mime_part.ggplot} \alias{mime_part.ggplot} \title{Creates a MIME part from a ggplot2 plot object} \usage{ \method{mime_part}{ggplot}(x, name = deparse(substitute(x)), device = pdf, ...) } \arguments{ \item{x}{A \code{ggplot} object} \item{name}{Name of attachment (sans .pdf extension).} \item{device}{Graphics device used to render the plot. Defaults to \code{pdf}.} \item{...}{Ignored.} } \value{ An S3 \code{mime_part} object. } \description{ Writes a PDF file of the plot defined by \code{x} and turns this PDF file into a file attachment. } sendmailR/man/mime_part.matrix.Rd0000644000176200001440000000065112407531607016521 0ustar liggesusers% Generated by roxygen2 (4.0.2): do not edit by hand \name{mime_part.matrix} \alias{mime_part.matrix} \title{Create a MIME part from a matrix.} \usage{ \method{mime_part}{matrix}(x, name = deparse(substitute(x)), ...) } \arguments{ \item{x}{Matrix} \item{name}{Basename of file attachment that is generated.} \item{...}{Ignored.} } \value{ An S3 \code{mime_part} object } \description{ Create a MIME part from a matrix. } sendmailR/man/mime_part.character.Rd0000644000176200001440000000114312407531607017146 0ustar liggesusers% Generated by roxygen2 (4.0.2): do not edit by hand \name{mime_part.character} \alias{mime_part.character} \title{Create a MIME part from a character string. If the string matches a filename, a MIME part containing that file is returned instead.} \usage{ \method{mime_part}{character}(x, name, ...) } \arguments{ \item{x}{Character string, possibly a filename.} \item{name}{Name of attachment.} \item{...}{Ignored.} } \value{ An S3 \code{mime_part} object. } \description{ Create a MIME part from a character string. If the string matches a filename, a MIME part containing that file is returned instead. } sendmailR/man/mime_part.Rd0000644000176200001440000000070512407531607015216 0ustar liggesusers% Generated by roxygen2 (4.0.2): do not edit by hand \name{mime_part} \alias{mime_part} \title{Create a MIME part} \usage{ mime_part(x, name, ...) } \arguments{ \item{x}{Object to include} \item{name}{Name of mime part. Usually the filename of the attachment as displayed by the e-mail client.} \item{...}{Possible further arguments for \code{mime_part} implementations.} } \value{ An S3 \code{mime_part} object. } \description{ Create a MIME part } sendmailR/man/mime_part.default.Rd0000644000176200001440000000076612407531607016650 0ustar liggesusers% Generated by roxygen2 (4.0.2): do not edit by hand \name{mime_part.default} \alias{mime_part.default} \title{Default MIME part method} \usage{ \method{mime_part}{default}(x, name, ...) } \arguments{ \item{x}{R object} \item{name}{Filename used for attachment (sans the .R extension)} \item{...}{Ignored.} } \value{ An S3 \code{mime_part} object. } \description{ Creates a string representation of the object \code{x} using \code{dput}. This representation is then turned into a file attachment. } sendmailR/man/sendmail.Rd0000644000176200001440000000245112407531607015035 0ustar liggesusers% Generated by roxygen2 (4.0.2): do not edit by hand \name{sendmail} \alias{sendmail} \title{Send mail from within R} \usage{ sendmail(from, to, subject, msg, cc, bcc, ..., headers = list(), control = list()) } \arguments{ \item{from}{From whom the mail message is (RFC2822 style address).} \item{to}{Recipient of the message (vector of valid RFC2822 style addresses).} \item{subject}{Subject line of message.} \item{msg}{Body text of message or a list containing \code{\link{mime_part}} objects.} \item{cc}{Carbon-copy recipients (vector of valid RFC2822 style addresses).} \item{bcc}{Blind carbon-copy recipients (vector of valid RFC2822 style addresses).} \item{headers}{Any other headers to include.} \item{control}{List of SMTP server settings. Valid values are the possible options for \code{\link{sendmail_options}}.} \item{\dots}{...} } \description{ Simplistic sendmail utility for R. Uses SMTP to submit a message to a local SMTP server. } \examples{ \dontrun{ from <- sprintf("", Sys.info()[4]) to <- "" subject <- "Hello from R" body <- list("It works!", mime_part(iris)) sendmail(from, to, subject, body, control=list(smtpServer="ASPMX.L.GOOGLE.COM")) } } \seealso{ \code{\link{mime_part}} for a way to add attachments. } \keyword{utilities} sendmailR/man/mime_part.trellis.Rd0000644000176200001440000000116112407531607016670 0ustar liggesusers% Generated by roxygen2 (4.0.2): do not edit by hand \name{mime_part.trellis} \alias{mime_part.trellis} \title{Creates a MIME part from a trellis plot object} \usage{ \method{mime_part}{trellis}(x, name = deparse(substitute(x)), device = pdf, ...) } \arguments{ \item{x}{A \code{trellis} (lattice) object} \item{name}{Name of attachment (sans .pdf extension).} \item{device}{Graphics device used to render the plot. Defaults to \code{pdf}.} \item{...}{Ignored.} } \value{ An S3 \code{mime_part} object. } \description{ Writes a PDF file of the plot defined by \code{x} and turns this PDF file into a file attachment. } sendmailR/man/mime_part.data.frame.Rd0000644000176200001440000000073212407531607017217 0ustar liggesusers% Generated by roxygen2 (4.0.2): do not edit by hand \name{mime_part.data.frame} \alias{mime_part.data.frame} \title{Create a MIME part from a \code{data.frame}.} \usage{ \method{mime_part}{data.frame}(x, name = deparse(substitute(x)), ...) } \arguments{ \item{x}{A \code{data.frame}.} \item{name}{Basename of file attachment that is generated.} \item{...}{Ignored.} } \value{ An S3 \code{mime_part} object. } \description{ Create a MIME part from a \code{data.frame}. } sendmailR/tools/0000755000176200001440000000000012407525457013343 5ustar liggesuserssendmailR/tools/roxygenize0000755000176200001440000000012112407525457015466 0ustar liggesusers#!/usr/bin/env Rscript library("methods") library("roxygen2") roxygenize("pkg") sendmailR/tools/set-version0000755000176200001440000000103712407525457015550 0ustar liggesusers#!/usr/bin/env Rscript get_version_from_git <- function() { tag <- system2("git", c("describe", "--tags", "--match", "v*"), stdout=TRUE, stderr=TRUE) is_clean <- system2("git", c("diff-index", "--quiet", tag)) == 0 tt <- sub("v", "", tag, fixed=TRUE) tt <- paste(strsplit(tt, "-")[[1]][1:2], collapse="-") if (!is_clean) tt <- sub("-.*", sprintf("-%i", as.integer(Sys.time())), tt) tt } desc <- read.dcf("pkg/DESCRIPTION") desc[,"Version"] <- get_version_from_git() write.dcf(desc, file="pkg/DESCRIPTION")