[med-svn] [r-cran-sendmailr] 06/07: New upstream version 1.2-1

Andreas Tille tille at debian.org
Fri Oct 20 12:15:46 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository r-cran-sendmailr.

commit ade257decd5c4ea97e05c127f6bfef442debdc60
Author: Andreas Tille <tille at debian.org>
Date:   Fri Oct 20 14:13:50 2017 +0200

    New upstream version 1.2-1
---
 DESCRIPTION                 |  20 +++++
 MD5                         |  17 ++++
 NAMESPACE                   |  13 +++
 R/mime_part.R               | 171 ++++++++++++++++++++++++++++++++++++
 R/options.R                 |  64 ++++++++++++++
 R/sendmailR.r               | 208 ++++++++++++++++++++++++++++++++++++++++++++
 debian/README.test          |  13 ---
 debian/changelog            |  21 -----
 debian/compat               |   1 -
 debian/control              |  23 -----
 debian/copyright            |  29 ------
 debian/docs                 |   1 -
 debian/rules                |   4 -
 debian/source/format        |   1 -
 debian/watch                |   2 -
 man/mime_part.Rd            |  23 +++++
 man/mime_part.character.Rd  |  23 +++++
 man/mime_part.data.frame.Rd |  21 +++++
 man/mime_part.default.Rd    |  23 +++++
 man/mime_part.ggplot.Rd     |  26 ++++++
 man/mime_part.matrix.Rd     |  21 +++++
 man/mime_part.trellis.Rd    |  26 ++++++
 man/sendmail.Rd             |  48 ++++++++++
 man/sendmail_options.Rd     |  44 ++++++++++
 tests/multiple_recipients.R |  48 ++++++++++
 tools/roxygenize            |   5 ++
 tools/set-version           |  16 ++++
 27 files changed, 817 insertions(+), 95 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
new file mode 100644
index 0000000..6186491
--- /dev/null
+++ b/DESCRIPTION
@@ -0,0 +1,20 @@
+Package: 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 at R: c(person("Olaf", "Mersmann", role=c("aut", "cre"),
+        email="olafm at 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 <olafm at p-value.net>
+NeedsCompilation: no
+Repository: CRAN
+Date/Publication: 2014-09-21 13:32:55
diff --git a/MD5 b/MD5
new file mode 100644
index 0000000..346bc2b
--- /dev/null
+++ b/MD5
@@ -0,0 +1,17 @@
+e74ad00026a32eca7c5f929dd1d1cbcd *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
diff --git a/NAMESPACE b/NAMESPACE
new file mode 100644
index 0000000..a499ae6
--- /dev/null
+++ b/NAMESPACE
@@ -0,0 +1,13 @@
+# 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)
diff --git a/R/mime_part.R b/R/mime_part.R
new file mode 100644
index 0000000..76615ec
--- /dev/null
+++ b/R/mime_part.R
@@ -0,0 +1,171 @@
+.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"))
+  }
+}
diff --git a/R/options.R b/R/options.R
new file mode 100644
index 0000000..776277b
--- /dev/null
+++ b/R/options.R
@@ -0,0 +1,64 @@
+## 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(...)
+}
diff --git a/R/sendmailR.r b/R/sendmailR.r
new file mode 100644
index 0000000..cbb52a0
--- /dev/null
+++ b/R/sendmailR.r
@@ -0,0 +1,208 @@
+##
+## sendmailR.r - send email from within R
+##
+## Author:
+##  Olaf Mersmann (OME) <olafm at datensplitter.net>
+##
+
+.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 <hostname> ESMTP
+  wait_for(220)
+  ## >> HELO localhost
+  ## << 250 mail.statistik.uni-dortmund.de
+  send_command(paste("HELO ", nodename), 250)
+  ## >> MAIL FROM: <foo at bah.com>
+  ## << 250 2.1.0 Ok
+  send_command(paste("MAIL FROM: ", headers$From), 250)
+  ## >> RCPT TO: <bah at baz.org>
+  ## << 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)
+  ## >> <actual message + headers + .>
+  if (verbose)
+    message(">> <message data>")
+
+  .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("<sendmailR@@\\%s>", Sys.info()[4])
+##' to <- "<olafm@@datensplitter.net>"
+##' 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())
+  }
+}
diff --git a/debian/README.test b/debian/README.test
deleted file mode 100644
index 5c00dc6..0000000
--- a/debian/README.test
+++ /dev/null
@@ -1,13 +0,0 @@
-Notes on how this package can be tested.
-────────────────────────────────────────
-
-This package can be tested typing the following into R
-
-require(sendmailR)
-sendmail('your at sender.address', 'the at recipient.address', 'Hello R', 'Mail send using sendmailR')
-
-and check whether the at recipient.address gets an e-mail from you.
-
-
- -- Andreas Tille <tille at debian.org>  Fri, 13 Jun 2014 22:52:06 +0200
-
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644
index f6d42e2..0000000
--- a/debian/changelog
+++ /dev/null
@@ -1,21 +0,0 @@
-r-cran-sendmailr (1.2-1-2) UNRELEASED; urgency=medium
-
-  * Fix Vcs-Browser
-  * cme fix dpkg-control
-  * debhelper 10
-
- -- Andreas Tille <tille at debian.org>  Mon, 02 Jan 2017 15:14:40 +0100
-
-r-cran-sendmailr (1.2-1-1) unstable; urgency=medium
-
-  * New upstream version
-  * cme fix dpkg-control
-  * debian/copyright: Fix DEP5 license name
-
- -- Andreas Tille <tille at debian.org>  Tue, 30 Sep 2014 17:09:44 +0200
-
-r-cran-sendmailr (1.1-2-1) unstable; urgency=low
-
-  * Initial release (Closes: #751734)
-
- -- Andreas Tille <tille at debian.org>  Fri, 13 Jun 2014 22:52:06 +0200
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
index f599e28..0000000
--- a/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-10
diff --git a/debian/control b/debian/control
deleted file mode 100644
index 9e07c7b..0000000
--- a/debian/control
+++ /dev/null
@@ -1,23 +0,0 @@
-Source: r-cran-sendmailr
-Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
-Uploaders: Andreas Tille <tille at debian.org>
-Section: gnu-r
-Priority: optional
-Build-Depends: debhelper (>= 10),
-               cdbs,
-               r-base-dev (>= 3.0.0),
-               r-cran-base64enc
-Standards-Version: 3.9.8
-Vcs-Browser: https://anonscm.debian.org/viewvc/debian-med/trunk/packages/R/r-cran-sendmailr/trunk/
-Vcs-Svn: svn://anonscm.debian.org/debian-med/trunk/packages/R/r-cran-sendmailr/trunk/
-Homepage: http://cran.r-project.org/web/packages/sendmailR/
-
-Package: r-cran-sendmailr
-Architecture: any
-Depends: ${shlibs:Depends},
-         ${R:Depends},
-         r-cran-base64enc
-Description: send email using GNU R
- This GNU R package contains a simple SMTP client which provides a
- portable solution for sending email, including attachements, from within
- GNU R.
diff --git a/debian/copyright b/debian/copyright
deleted file mode 100644
index af37d0a..0000000
--- a/debian/copyright
+++ /dev/null
@@ -1,29 +0,0 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Upstream-Name: sendmailR
-Upstream-Contact: Olaf Mersmann <olafmqdatensplitter.net>
-Source: http://cran.r-project.org/web/packages/sendmailR/
-
-Files: *
-Copyright: 2012-2014 Olaf Mersmann <olafmqdatensplitter.net>
-License: GPL-2
-
-Files: debian/*
-Copyright: 2014 Andreas Tille <tille at debian.org>
-License: GPL-2
-
-License: GPL-2
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 2 of the License, or
- (at your option) any later version.
- .
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
- .
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>.
- .
- On Debian systems, the complete text of the GNU Public
- License can be found in `/usr/share/common-licenses/GPL'.
diff --git a/debian/docs b/debian/docs
deleted file mode 100644
index 50f6656..0000000
--- a/debian/docs
+++ /dev/null
@@ -1 +0,0 @@
-debian/README.test
diff --git a/debian/rules b/debian/rules
deleted file mode 100755
index d643f96..0000000
--- a/debian/rules
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/make -f
-# 							-*- makefile -*-
-
-include /usr/share/R/debian/r-cran.mk
diff --git a/debian/source/format b/debian/source/format
deleted file mode 100644
index 163aaf8..0000000
--- a/debian/source/format
+++ /dev/null
@@ -1 +0,0 @@
-3.0 (quilt)
diff --git a/debian/watch b/debian/watch
deleted file mode 100644
index b77751f..0000000
--- a/debian/watch
+++ /dev/null
@@ -1,2 +0,0 @@
-version=3
-http://cran.r-project.org/src/contrib/sendmailR_([-\d.]*)\.tar\.gz
diff --git a/man/mime_part.Rd b/man/mime_part.Rd
new file mode 100644
index 0000000..c8421f5
--- /dev/null
+++ b/man/mime_part.Rd
@@ -0,0 +1,23 @@
+% 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
+}
+
diff --git a/man/mime_part.character.Rd b/man/mime_part.character.Rd
new file mode 100644
index 0000000..091af50
--- /dev/null
+++ b/man/mime_part.character.Rd
@@ -0,0 +1,23 @@
+% 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.
+}
+
diff --git a/man/mime_part.data.frame.Rd b/man/mime_part.data.frame.Rd
new file mode 100644
index 0000000..6b041fc
--- /dev/null
+++ b/man/mime_part.data.frame.Rd
@@ -0,0 +1,21 @@
+% 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}.
+}
+
diff --git a/man/mime_part.default.Rd b/man/mime_part.default.Rd
new file mode 100644
index 0000000..7330fbf
--- /dev/null
+++ b/man/mime_part.default.Rd
@@ -0,0 +1,23 @@
+% 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.
+}
+
diff --git a/man/mime_part.ggplot.Rd b/man/mime_part.ggplot.Rd
new file mode 100644
index 0000000..33dfe6d
--- /dev/null
+++ b/man/mime_part.ggplot.Rd
@@ -0,0 +1,26 @@
+% 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.
+}
+
diff --git a/man/mime_part.matrix.Rd b/man/mime_part.matrix.Rd
new file mode 100644
index 0000000..630c5b1
--- /dev/null
+++ b/man/mime_part.matrix.Rd
@@ -0,0 +1,21 @@
+% 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.
+}
+
diff --git a/man/mime_part.trellis.Rd b/man/mime_part.trellis.Rd
new file mode 100644
index 0000000..d1e040e
--- /dev/null
+++ b/man/mime_part.trellis.Rd
@@ -0,0 +1,26 @@
+% 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.
+}
+
diff --git a/man/sendmail.Rd b/man/sendmail.Rd
new file mode 100644
index 0000000..da7afdc
--- /dev/null
+++ b/man/sendmail.Rd
@@ -0,0 +1,48 @@
+% 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("<sendmailR@\\\\\%s>", Sys.info()[4])
+to <- "<olafm at datensplitter.net>"
+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}
+
diff --git a/man/sendmail_options.Rd b/man/sendmail_options.Rd
new file mode 100644
index 0000000..7c8147e
--- /dev/null
+++ b/man/sendmail_options.Rd
@@ -0,0 +1,44 @@
+% 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 at datensplitter.net}
+}
+
diff --git a/tests/multiple_recipients.R b/tests/multiple_recipients.R
new file mode 100644
index 0000000..6151e38
--- /dev/null
+++ b/tests/multiple_recipients.R
@@ -0,0 +1,48 @@
+library("sendmailR")
+
+sendmail(from="from at example.org",
+         to="to1 at example.org",
+         subject="foo",
+         msg="bar",
+         control=list(transport="debug"))
+
+sendmail(from="from at example.org",
+         to=c("to1 at example.org", "to2 at example.org"),
+         subject="foo",
+         msg="bar",
+         control=list(transport="debug"))
+
+sendmail(from="from at example.org",
+         to=c("to1 at example.org", "to2 at example.org"),
+         cc="cc1 at example.org",
+         subject="foo",
+         msg="bar",
+         control=list(transport="debug"))
+
+sendmail(from="from at example.org",
+         to=c("to1 at example.org", "to2 at example.org"),
+         cc="cc1 at example.org",
+         subject="foo",
+         msg="bar",
+         control=list(transport="debug"))
+         
+sendmail(from="from at example.org",
+         to="to1 at example.org",
+         cc=c("cc1 at example.org", "cc2 at example.org"),
+         subject="foo",
+         msg="bar",
+         control=list(transport="debug"))
+
+sendmail(from="from at example.org",
+         to="to1 at example.org",
+         bcc="bcc1 at example.org",
+         subject="foo",
+         msg="bar",
+         control=list(transport="debug"))
+
+sendmail(from="from at example.org",
+         to="to1 at example.org",
+         bcc=c("bcc1 at example.org", "bcc2 at example.org"),
+         subject="foo",
+         msg="bar",
+         control=list(transport="debug"))
diff --git a/tools/roxygenize b/tools/roxygenize
new file mode 100755
index 0000000..3943683
--- /dev/null
+++ b/tools/roxygenize
@@ -0,0 +1,5 @@
+#!/usr/bin/env Rscript
+
+library("methods")
+library("roxygen2")
+roxygenize("pkg")
diff --git a/tools/set-version b/tools/set-version
new file mode 100755
index 0000000..4926477
--- /dev/null
+++ b/tools/set-version
@@ -0,0 +1,16 @@
+#!/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")

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-cran-sendmailr.git



More information about the debian-med-commit mailing list