From 5d1262dd9d335620f89f14ab9e5060b65cea3f56 Mon Sep 17 00:00:00 2001 From: Are Edvardsen Date: Tue, 13 Dec 2022 14:17:09 +0100 Subject: [PATCH] subject enc now part of sendmailR --- DESCRIPTION | 3 +-- R/sendEmail.R | 17 ++--------------- man/sendEmail.Rd | 3 +-- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0e55678e..31fa93a9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: rapbase Type: Package Title: Base Functions and Resources for Rapporteket -Version: 1.23.1 +Version: 1.23.1.9000 Authors@R: c( person(given = "Are", family = "Edvardsen", @@ -24,7 +24,6 @@ LazyData: true Depends: R (>= 3.5.0) Imports: - base64enc, bookdown, DBI, digest, diff --git a/R/sendEmail.R b/R/sendEmail.R index 5276a7ba..676ddd7b 100644 --- a/R/sendEmail.R +++ b/R/sendEmail.R @@ -8,8 +8,7 @@ #' address, SMTP server url and port number #' @param to Character vector containing email addresses. May also contain #' full names like '\code{Jane Doe }' -#' @param subject Character string providing email subject. The string is -#' converted within this function to conform to RFC 1342 +#' @param subject Character string providing email subject. #' @param text Character string providing the plain email text #' @param attFile Character string providing the full file path to an #' attachment. Default is NULL in which case no attachment is made @@ -21,24 +20,12 @@ sendEmail <- function(conf, to, subject, text, attFile = NULL) { if (!is.null(attFile)) { stopifnot(file.exists(attFile)) } - # nocov start - # apply RFC 1342 on headers (i.e. subject) - charset <- "=?UTF-8?" - enc <- "B?" - headPost <- "?=" + # nocov start from <- conf$network$sender # escape spaces (e.g. when full name is added to ) to <- gsub(" ", "\\ ", to, fixed = TRUE) - # Subject is a header field, hence non-ascii to be base64 encoded - # Header lines must be 76 chars or less and split by a space - # and contain consistent encoded-word(s) - subject <- charToRaw(subject) - subject <- base64enc::base64encode(subject, linewidth = 63) - subject <- paste(paste0(charset, enc, subject, headPost), - collapse = " " - ) if (is.null(attFile)) { body <- list(text) diff --git a/man/sendEmail.Rd b/man/sendEmail.Rd index 36f3de7f..2a363e9d 100644 --- a/man/sendEmail.Rd +++ b/man/sendEmail.Rd @@ -13,8 +13,7 @@ address, SMTP server url and port number} \item{to}{Character vector containing email addresses. May also contain full names like '\code{Jane Doe }'} -\item{subject}{Character string providing email subject. The string is -converted within this function to conform to RFC 1342} +\item{subject}{Character string providing email subject.} \item{text}{Character string providing the plain email text}