emayili/ 0000755 0001762 0000144 00000000000 14611761012 011702 5 ustar ligges users emayili/NAMESPACE 0000644 0001762 0000144 00000004036 14611735773 013143 0 ustar ligges users # Generated by roxygen2: do not edit by hand
S3method(Ops,address)
S3method(Ops,encodable)
S3method(after,MIME)
S3method(as.character,address)
S3method(as.character,envelope)
S3method(as.character,header)
S3method(before,MIME)
S3method(c,address)
S3method(format,address)
S3method(length,MIME)
S3method(length,address)
S3method(print,address)
S3method(print,envelope)
S3method(print,header)
export("%>%")
export(address)
export(as.address)
export(attachment)
export(bcc)
export(cc)
export(cleave)
export(comments)
export(compliant)
export(display)
export(domain)
export(encrypt)
export(envelope)
export(expires)
export(from)
export(gmail)
export(html)
export(importance)
export(inreplyto)
export(keywords)
export(local)
export(mailersend)
export(mailfence)
export(mailgun)
export(mailtrap)
export(normalise)
export(parties)
export(priority)
export(qp_decode)
export(qp_encode)
export(raw)
export(references)
export(render)
export(reply)
export(replyby)
export(request_receipt_delivery)
export(request_receipt_read)
export(return_path)
export(sender)
export(sendgrid)
export(sendinblue)
export(sensitivity)
export(server)
export(signature)
export(smtpbucket)
export(subject)
export(template)
export(text)
export(to)
export(validate)
export(zeptomail)
import(curl)
import(digest)
import(dplyr)
import(htmltools)
import(logger)
import(purrr)
import(rvest)
import(stringi)
import(stringr)
import(tidyr)
import(xml2)
importFrom(base64enc,base64decode)
importFrom(base64enc,base64encode)
importFrom(commonmark,markdown_html)
importFrom(glue,glue)
importFrom(httr,http_date)
importFrom(magrittr,"%>%")
importFrom(mime,guess_type)
importFrom(rmarkdown,html_document)
importFrom(rmarkdown,render)
importFrom(stats,na.omit)
importFrom(stats,setNames)
importFrom(stringi,stri_enc_mark)
importFrom(stringi,stri_replace_all_fixed)
importFrom(stringi,stri_replace_all_regex)
importFrom(stringi,stri_trans_nfkc)
importFrom(tools,file_ext)
importFrom(urltools,url_decode)
importFrom(utils,download.file)
importFrom(utils,modifyList)
importFrom(utils,packageVersion)
importFrom(xfun,read_utf8)
emayili/tools/ 0000755 0001762 0000144 00000000000 14611676075 013060 5 ustar ligges users emayili/tools/check.R 0000644 0001762 0000144 00000003505 14611676075 014263 0 ustar ligges users library(dplyr)
# spelling::spell_check_package()
devtools::check(cran = TRUE)
# Incoming feasibility checks for CRAN.
#
devtools::check(
manual = TRUE,
remote = TRUE,
incoming = TRUE
)
# Check it on Windows.
#
devtools::check_win_devel()
rhub::check_for_cran(
platforms = c(
# ==========================================================================
# -> devel
# ==========================================================================
"debian-clang-devel",
"debian-gcc-devel",
# "ubuntu-gcc-devel",
"fedora-clang-devel",
"fedora-gcc-devel",
"windows-x86_64-devel",
# ==========================================================================
# -> patched
# ==========================================================================
"debian-gcc-patched",
"windows-x86_64-patched",
# "solaris-x86-patched",
# ==========================================================================
# -> release
# ==========================================================================
"debian-gcc-release",
"ubuntu-gcc-release",
"macos-highsierra-release",
# "macos-m1-bigsur-release",
"windows-x86_64-release"
),
env_vars = c(
`_R_CHECK_FORCE_SUGGESTS_` = "false",
`_R_CHECK_CRAN_INCOMING_USE_ASPELL_` = "false"
)
)
# Check on macOS.
#
rhub::check_for_cran(
platforms = rhub::platforms() %>%
filter(categories == "macOS") %>%
pull(name),
env_vars = c(
`_R_CHECK_FORCE_SUGGESTS_` = "true",
`_R_CHECK_CRAN_INCOMING_USE_ASPELL_` = "false"
)
)
# # Try this one instead?
# #
# rhub::check(platform = c("macos-highsierra-release"))
#
# rhub::check_for_cran(
# platforms = "macos-highsierra-release-cran",
# env_vars = c(
# `_R_CHECK_FORCE_SUGGESTS_` = "true",
# `_R_CHECK_CRAN_INCOMING_USE_ASPELL_` = "false"
# )
# )
emayili/tools/coverage.R 0000644 0001762 0000144 00000000207 14611676075 014775 0 ustar ligges users library(covr)
# Tests that are skipped on CRAN should still be included in coverage report.
#
Sys.setenv(NOT_CRAN = "true")
report()
emayili/tools/lint.R 0000644 0001762 0000144 00000000042 14611676075 014145 0 ustar ligges users lintr::lint_package(cache = TRUE)
emayili/README.md 0000644 0001762 0000144 00000034745 14611676075 013214 0 ustar ligges users
# emayili
[](https://cran.r-project.org/package=emayili)

[](https://app.codecov.io/gh/datawookie/emayili)
[](https://lifecycle.r-lib.org/articles/stages.html)
`{emayili}` is a package for sending emails from R. The design goals
are:
- works on all manner of SMTP servers and
- has minimal dependencies (or dependencies which are easily satisfied).
The package name is an adaption of the Zulu word for email, *imeyili*.
The documentation for `{emayili}` can be found
[here](https://datawookie.github.io/emayili/).
## Installation
Get the stable version from
[CRAN](https://CRAN.R-project.org/package=emayili).
``` r
install.packages("emayili")
```
Or grab it directly from
[GitHub](https://github.com/datawookie/emayili).
``` r
# Install from the master branch.
remotes::install_github("datawookie/emayili")
# Install from the development branch.
remotes::install_github("datawookie/emayili", ref = "dev")
```
## Usage
Load the library.
``` r
library(emayili)
packageVersion("emayili")
```
[1] '0.7.17'
Create a message object.
``` r
email <- envelope()
```
### Creating a Message
The message has class `envelope`.
``` r
class(email)
```
[1] "envelope"
Add addresses for the sender and recipient.
``` r
email <- email %>%
from("alice@yahoo.com") %>%
to("bob@google.com") %>%
cc("craig@google.com")
```
There are also `bcc()` and `reply()` functions for setting the `Bcc` and
`Reply-To` fields.
You can supply multiple addresses in a variety of formats:
- as a single comma-separated string
- as separate strings; or
- as a vector of strings.
``` r
envelope() %>% to("bob@google.com, craig@google.com, erin@gmail.com")
envelope() %>% to("bob@google.com", "craig@google.com", "erin@gmail.com")
envelope() %>% to(c("bob@google.com", "craig@google.com", "erin@gmail.com"))
```
Add a subject.
``` r
email <- email %>% subject("This is a plain text message!")
```
Add a text body.
``` r
email <- email %>% text("Hello!")
```
You can use `html()` to add an HTML body. It accepts either a vector of
characters or a `tagList()` from `{htmltools}`.
``` r
library(htmltools)
email <- email %>% html(
tagList(
h2("Hello"),
p("World!")
)
)
```
Add an attachment.
``` r
email <- email %>% attachment("image.jpg")
```
You can also create the message in a single command:
``` r
email <- envelope(
to = "bob@google.com",
from = "alice@yahoo.com",
subject = "This is a plain text message!",
text = "Hello!"
)
```
Simply printing a message displays the header information.
``` r
email
```
Date: Sat, 19 Aug 2023 04:44:05 GMT
X-Mailer: {emayili}-0.7.17
MIME-Version: 1.0
From: alice@yahoo.com
To: bob@google.com
Cc: craig@google.com
Subject: This is a plain text message!
You can identify emails which have been sent using `{emayili}` by the
presence of an `X-Mailer` header which includes both the package name
and version.
If you want to see the complete MIME object, just convert to a string.
You can also call the `print()` method and specify `details = TRUE`.
### Options
You can set the `envelope.details` option to assert that the details
should always be printed.
``` r
# Always print envelope details.
#
options(envelope.details = TRUE)
```
By default the results returned by most of the methods are invisible.
You can make them visible via the `envelope.invisible` (default:
`TRUE`).
``` r
# Always show envelope.
#
options(envelope.invisible = FALSE)
```
### Interpolating Text
You can use `{glue}` syntax to interpolate content into the body of a
message.
``` r
name <- "Alice"
envelope() %>%
text("Hello {{name}}!")
```
Date: Sat, 19 Aug 2023 04:44:05 GMT
X-Mailer: {emayili}-0.7.17
MIME-Version: 1.0
Content-Type: text/plain;
charset=utf-8;
format=flowed
Content-Transfer-Encoding: 7bit
Content-MD5: nhjeY5ZYMzru+kSCGUzNKg==
Hello Alice!
### Rendering Markdown
You can render Markdown straight into a message.
Use either plain Markdown.
``` r
envelope() %>%
# Render plain Markdown from a character vector.
render(
"Check out [`{emayili}`](https://cran.r-project.org/package=emayili)."
)
```
Date: Sat, 19 Aug 2023 04:44:05 GMT
X-Mailer: {emayili}-0.7.17
MIME-Version: 1.0
Content-Type: text/html;
charset=utf-8
Check out {emayili}
.
Or R Markdown.
``` r
envelope() %>%
# Render R Markdown from a file.
render("message.Rmd")
```
In both cases the function will accept either a file path or a character
vector containing Markdown text.
Interpolation also works with `render()`.
### Rendered CSS
When you render an R Markdown document the resulting HTML includes CSS
from three sources:
- [Bootstrap](https://getbootstrap.com/)
- [highlightjs](https://highlightjs.org/) and
- `{rmarkdown}`.
You can control which of these propagate to the message using the
`include_css` parameter which, by default, is set to
`c("rmd", "bootstrap", "highlight")`.
🚨 *Note:* Gmail doesn’t like the Bootstrap CSS. If you want your
styling to work on Gmail you should set
`include_css = c("rmd", "highlight")`.
### Extra CSS
You can insert extra CSS into your rendered messages.
``` r
envelope() %>%
render("message.Rmd", css_files = "extra.css")
```
If you are having trouble getting this to work with Gmail then it might
be worthwhile taking a look at their [CSS
support](https://developers.google.com/gmail/design/css).
### Adding an Inline Image
Adding an inline image to an HTML message is possible. There are two
ways to achieve this.
*1. Base64 Encoding*
First you’ll need to [Base64
encode](https://en.wikipedia.org/wiki/Base64) the image.
``` r
img_base64 <- base64enc::base64encode("image.jpg")
```
Then create the HTML message body.
``` r
html_body <- sprintf('
', img_base64)
```
And finally add it to the email.
``` r
email <- envelope() %>% html(html_body)
```
*Note:* It’s important that you specify the appropriate media type
(`image/jpeg` for JPEG and `image/png` for PNG).
*2. Using a CID*
Unfortunately some mail clients (like Gmail) will not display Base64
encoded images. In this case using a CID is a working alternative.
First create the message body which references an image by CID.
``` r
html_body <- '
'
```
Then attach the image and specify the `cid` argument.
``` r
email <- envelope() %>%
html(html_body) %>%
attachment(path = "image.jpg", cid = "image")
```
### Create a Server Object
Create a SMTP server object.
``` r
smtp <- server(
host = "smtp.gmail.com",
port = 465,
username = "bob@gmail.com",
password = "bd40ef6d4a9413de9c1318a65cbae5d7"
)
```
It’s bad practice to include credentials in a script. A better approach
would be to keep the credentials in your `.Renviron` file.
GMAIL_USERNAME="bob@gmail.com"
GMAIL_PASSWORD="bd40ef6d4a9413de9c1318a65cbae5d7"
You can then pull these variables into R using `Sys.getenv()` and then
create the server object.
``` r
smtp <- server(
host = "smtp.gmail.com",
port = 465,
username = Sys.getenv("GMAIL_USERNAME"),
password = Sys.getenv("GMAIL_PASSWORD")
)
```
If you’re trying to send email with a host that uses the STARTTLS
security protocol (like Gmail, Yahoo! or AOL), then it will most
probably be blocked due to insufficient security. In order to circumvent
this, you can grant access to less secure apps. See the links below for
specifics:
- [Gmail](https://myaccount.google.com/security)
- [Yahoo!](https://login.yahoo.com/account/security) and
- [AOL](https://login.aol.com/account/security).
Gmail has recently changed their authentication procedure. If you are
having trouble connecting to the Gmail SMTP server then take a look at
[this](https://datawookie.dev/blog/2022/03/updated-gmail-authentication/).
### Sending a Message
Send the message.
``` r
smtp(email, verbose = TRUE)
```
To see the guts of the message as passed to the SMTP server:
``` r
print(email, details = TRUE)
```
### Encryption
Both transport-level encryption and end-to-end [email
encryption](https://en.wikipedia.org/wiki/Email_encryption) are
supported. An SMTP connection can be initiated on port 465 (SMTPS, see
[RFC 8314](https://www.rfc-editor.org/rfc/rfc8314)) or 587 (SMTP-MSA,
see [RFC 6409](https://www.rfc-editor.org/rfc/rfc6409)), enabling
transport-level encryption. Public-key cryptography (via GnuPG) can be
used to sign and/or encrypt message contents for end-to-end encryption.
## Standards Documents
The following (draft) standards documents relate to emails:
- [RFC 2822](https://www.rfc-editor.org/rfc/rfc2822) — Internet Message
Format
- [RFC 5321](https://www.rfc-editor.org/rfc/rfc5321) — Simple Mail
Transfer Protocol
- [RFC 5322](https://www.rfc-editor.org/rfc/rfc5322) — Internet Message
Format
- [RFC 6854](https://www.rfc-editor.org/rfc/rfc6854) — an update to RFC
5322.
## Similar Packages
There is a selection of other R packages which also send emails:
- [blastula](https://cran.r-project.org/package=blastula)
- [blatr](https://cran.r-project.org/package=blatr) (Windows)
- [gmailr](https://cran.r-project.org/package=gmailr)
- [mail](https://cran.r-project.org/package=mail)
- [mailR](https://cran.r-project.org/package=mailR)
- [sendmailR](https://cran.r-project.org/package=sendmailR)
- [ponyexpress](https://github.com/ropensci-archive/ponyexpress)
## Blog Posts
## Developer Notes
### Code Coverage
You can find the test coverage report at
[Codecov](https://app.codecov.io/gh/datawookie/emayili). For development
purposes it’s more convenient to use the
[`{covr}`](https://cran.r-project.org/package=covr) package.
Generate a coverage report.
``` r
library(covr)
# Tests that are skipped on CRAN should still be included in coverage report.
#
Sys.setenv(NOT_CRAN = "true")
report()
```
Calculate test coverage.
``` r
coverage <- package_coverage()
```
Coverage statistics as a data frame.
``` r
as.data.frame(coverage)
```
Show lines without coverage.
``` r
zero_coverage(coverage)
```
### Checks
Check spelling.
``` r
spelling::spell_check_package()
```
Quick local checks.
``` r
devtools::check()
```
Remote checks (take longer but more thorough).
``` r
devtools::check_win_devel()
# Check for a specific platform.
#
rhub::check(platform = "debian-gcc-devel")
rhub::check_on_windows(check_args = "--force-multiarch")
rhub::check_on_solaris()
# Check on a bunch of platforms.
#
rhub::check_for_cran()
# Check on important platforms.
#
rhub::check_for_cran(platforms = c(
"debian-gcc-release",
"ubuntu-gcc-release",
"macos-m1-bigsur-release",
"windows-x86_64-release",
NULL
))
```
emayili/man/ 0000755 0001762 0000144 00000000000 14611754773 012475 5 ustar ligges users emayili/man/print.address.Rd 0000644 0001762 0000144 00000000743 14611676075 015546 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/address.R
\name{print.address}
\alias{print.address}
\title{Print an address object}
\usage{
\method{print}{address}(x, ...)
}
\arguments{
\item{x}{An \code{address} object.}
\item{...}{Further arguments passed to or from other methods.}
}
\description{
If display name is specifed as "Last, First" then the display name will be
quoted.
}
\examples{
gerry <- as.address("gerry@gmail.com")
print(gerry)
}
emayili/man/comments.Rd 0000644 0001762 0000144 00000001204 14611676075 014604 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/header-mail.R
\name{comments}
\alias{comments}
\title{Add or query comments of message.}
\usage{
comments(msg, comments = NULL)
}
\arguments{
\item{msg}{A message object.}
\item{comments}{Comments for the message.}
}
\value{
A message object or the comments of the message object (if \code{comments} is \code{NULL}).
}
\description{
Add or query comments of message.
}
\examples{
# Create a message and set the comments.
msg <- envelope() \%>\% comments("This is a comment")
# Retrieve the comments for a message.
comments(msg)
}
\seealso{
\code{\link{subject}}
}
emayili/man/sensitivity.Rd 0000644 0001762 0000144 00000001763 14611676075 015363 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/header-sensitivity.R
\name{sensitivity}
\alias{sensitivity}
\title{Set or query message sensitivity}
\usage{
sensitivity(msg, sensitivity = NULL)
}
\arguments{
\item{msg}{A message object.}
\item{sensitivity}{Sensitivity level. One of \code{"personal"}, \code{"private"}, or \code{"company-confidential"}.}
}
\value{
A message object.
}
\description{
Manipulate the \code{Sensitivity} field as specified in \href{https://www.ietf.org/rfc/rfc2156.txt}{RFC 2156}.
}
\examples{
# Not sensitive.
envelope() \%>\%
subject("Your daily dose of spam")
# Sensitive personal message.
envelope() \%>\%
subject("The results from your test") \%>\%
sensitivity("personal")
# Sensitive private message.
envelope() \%>\%
subject("Your OTP (don't show this to anybody!") \%>\%
sensitivity("private")
# Sensitive business message.
envelope() \%>\%
subject("Top Secret Strategy Document") \%>\%
sensitivity("company-confidential")
}
emayili/man/addresses.Rd 0000644 0001762 0000144 00000003172 14611676075 014742 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/header-mail.R
\name{addresses}
\alias{addresses}
\alias{to}
\alias{cc}
\alias{bcc}
\alias{from}
\alias{reply}
\alias{return_path}
\alias{sender}
\title{Add address fields to message}
\usage{
to(msg, ..., append = TRUE)
cc(msg, ..., append = TRUE)
bcc(msg, ..., append = TRUE)
from(msg, addr = NULL)
reply(msg, addr = NULL)
return_path(msg, addr = NULL)
sender(msg, addr = NULL)
}
\arguments{
\item{msg}{A message object.}
\item{...}{Addresses.}
\item{append}{Whether to append or replace addresses.}
\item{addr}{Single address.}
}
\value{
A message object.
}
\description{
Add address fields to message
}
\examples{
# Populating the To field.
msg <- envelope()
msg \%>\% to("bob@gmail.com, alice@yahoo.com")
msg \%>\% to("bob@gmail.com", "alice@yahoo.com")
msg \%>\% to(c("bob@gmail.com", "alice@yahoo.com"))
# Populating the Cc field.
msg <- envelope()
msg \%>\% cc("bob@gmail.com, alice@yahoo.com")
msg \%>\% cc("bob@gmail.com", "alice@yahoo.com")
msg \%>\% cc(c("bob@gmail.com", "alice@yahoo.com"))
# Populating the Bcc field.
msg <- envelope()
msg \%>\% bcc("bob@gmail.com, alice@yahoo.com")
msg \%>\% bcc("bob@gmail.com", "alice@yahoo.com")
msg \%>\% bcc(c("bob@gmail.com", "alice@yahoo.com"))
msg <- envelope()
# Populating the From field.
msg \%>\% from("craig@gmail.com")
# Populating the Reply-To field.
msg <- envelope()
msg \%>\% reply("gerry@gmail.com")
# Populating the Return-Path field.
msg <- envelope()
msg \%>\% return_path("bounced-mail@devnull.org")
# Populating the Sender field.
msg <- envelope()
msg \%>\% sender("on_behalf_of@gmail.com")
}
emayili/man/qp.Rd 0000644 0001762 0000144 00000001160 14611676075 013400 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/encoding.R
\name{qp}
\alias{qp}
\alias{qp_encode}
\alias{qp_decode}
\title{Quoted-Printable encoding}
\usage{
qp_encode(x, crlf = CRLF)
qp_decode(x)
}
\arguments{
\item{x}{A string for encoding or decoding.}
\item{crlf}{End-of-line characters.}
}
\value{
An encoded string for \code{qp_encode()} or a decoded string for \code{qp_decode()}.
}
\description{
Encode to and decode from Quoted-Printable encoding.
}
\examples{
qp_encode("Mieux vaut être seul que mal accompagné.")
qp_decode("Mieux vaut =C3=AAtre seul que mal accompagn=C3=A9.")
}
emayili/man/as.character.header.Rd 0000644 0001762 0000144 00000000763 14611676075 016555 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/header.R
\name{as.character.header}
\alias{as.character.header}
\title{Create formatted header.}
\usage{
\method{as.character}{header}(x, width = 30, ...)
}
\arguments{
\item{x}{A header object.}
\item{width}{The width of the head name field.}
\item{...}{Further arguments passed to or from other methods.}
}
\value{
A formatted header field.
}
\description{
Accepts a header object and formats it as a header field.
}
emayili/man/render.Rd 0000644 0001762 0000144 00000006634 14611676075 014252 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/render.R
\name{render}
\alias{render}
\title{Render Markdown into email}
\usage{
render(
msg,
input,
params = NULL,
squish = TRUE,
css_files = c(),
include_css = c("rmd", "bootstrap"),
language = FALSE,
interpolate = TRUE,
.open = "{{",
.close = "}}",
.envir = NULL
)
}
\arguments{
\item{msg}{A message object.}
\item{input}{The input Markdown file to be rendered or a character vector of
Markdown text.}
\item{params}{A list of named parameters that override custom parameters
specified in the YAML front-matter.}
\item{squish}{Whether to clean up whitespace in rendered document.}
\item{css_files}{Extra CSS files.}
\item{include_css}{Whether to include rendered CSS from various sources
(\code{"rmd"} — native R Markdown CSS; \code{"bootstrap"} — Bootstrap CSS).}
\item{language}{Language of content. If \code{FALSE} then will not include
language field. If \code{TRUE} then will attempt to auto-detect language.
Otherwise will use the specified language.}
\item{interpolate}{Whether or not to interpolate into input using \link[glue]{glue}.}
\item{.open}{The opening delimiter.}
\item{.close}{The closing delimiter.}
\item{.envir}{Environment used for \code{glue} interpolation. Defaults to \code{parent.frame()}.}
}
\value{
A message object.
}
\description{
Render either Plain Markdown or R Markdown directly into the body of an email.
If \code{input} is a file then it will be interpreted as R Markdown it its
extension is either \code{"Rmd"} or \code{"Rmarkdown"}. Otherwise it will be
processed as Plain Markdown.
}
\section{Plain Markdown}{
Plain Markdown is processed with \code{\link[commonmark:commonmark]{commonmark::markdown_html()}}.
}
\section{R Markdown}{
R Markdown is processed with \code{\link[rmarkdown:render]{rmarkdown::render()}}.
Regardless of what \code{output} type is specified in the input file,
\code{render()} will always use the \code{"html_document"} output format.
Rending an R Markdown document can result in a lot of CSS. When all of the
CSS is included in the HTML \verb{} and sent to GMail it can result in a
message which is not correctly displayed inline in the Gmail web client.
To get around this you can specify \code{include_css = FALSE}. This will mean
that some styling will not be present in the resulting message, but that
the message content will be correctly rendered inline.
}
\examples{
# Plain Markdown
markdown <- "[This](https://www.google.com) is a link."
filename <- "message.md"
# Render from Markdown in character vector.
msg <- envelope() \%>\% render(markdown)
# Create a file containing Markdown
cat(markdown, file = filename)
# Render from Markdown in file.
msg <- envelope() \%>\% render(filename)
# Cleanup.
file.remove(filename)
# R Markdown
filename <- "gh-doc.Rmd"
# Create an Rmd document from template.
rmarkdown::draft(
filename,
template = "github_document",
package = "rmarkdown",
edit = FALSE
)
# Check for suitable version of Pandoc (https://pandoc.org/).
#
# Need to have version 2.0 or greater to support required --quiet option.
#
pandoc <- rmarkdown::find_pandoc()
suitable_pandoc <- !is.null(pandoc$dir) && grepl("^2", pandoc$version)
# Render from Rmd file.
if (suitable_pandoc) {
msg <- envelope() \%>\%
render(filename, include_css = c("rmd", "bootstrap"))
}
# Cleanup.
file.remove(filename)
}
\seealso{
\code{\link{text}}, \code{\link{html}}
}
emayili/man/precedence.Rd 0000644 0001762 0000144 00000003236 14611676075 015063 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/header-precedence.R
\name{precedence}
\alias{precedence}
\alias{priority}
\alias{importance}
\title{Add fields for message importance and priority}
\usage{
priority(msg, priority = NULL)
importance(msg, importance = NULL)
}
\arguments{
\item{msg}{A message object.}
\item{priority}{Priority level. One of \code{"non-urgent"}, \code{"normal"}, or \code{"urgent"}.}
\item{importance}{Importance level. One of \code{"low"}, \code{"normal"}, or \code{"high"}.}
}
\value{
A message object.
}
\description{
Functions to influence message delivery speed and importance.
}
\details{
The \code{priority()} function adds the \code{Priority} header field which gives a hint
to influence transmission speed and delivery. Valid values are
\code{"non-urgent"}, \code{"normal"}, and \code{"urgent"}. The non-standard \code{X-Priority}
header field is similar, for which valid values are \code{1} (Highest), \code{2}
(High), \code{3} (Normal, the default), \code{4} (Low), and \code{5} (Lowest).
The \code{importance()} function adds the \code{Importance} header field, which gives a
hint to the message recipient about how important the message is. Does not
influence delivery speed.
}
\examples{
# How rapidly does the message need to be delivered?
#
envelope() \%>\%
subject("Deliver this immediately!") \%>\%
priority("urgent")
envelope(priority = "non-urgent") \%>\%
subject("No rush with this.")
# How much attention should be paid by recipient?
#
envelope() \%>\%
subject("Read this immediately!") \%>\%
importance("high")
envelope(importance = "low") \%>\%
subject("Not important at all. Just delete.")
}
emayili/man/as.character.envelope.Rd 0000644 0001762 0000144 00000001120 14611676075 017126 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/envelope.R
\name{as.character.envelope}
\alias{as.character.envelope}
\title{Create formatted message.}
\usage{
\method{as.character}{envelope}(x, ..., details = TRUE, encode = FALSE)
}
\arguments{
\item{x}{A message object.}
\item{...}{Further arguments passed to or from other methods.}
\item{details}{Whether or not to display full message content.}
\item{encode}{Whether to encode headers.}
}
\value{
A formatted message object.
}
\description{
Accepts a message object and formats it as a MIME document.
}
emayili/man/attachment.Rd 0000644 0001762 0000144 00000002321 14611676075 015110 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attachment.R
\name{attachment}
\alias{attachment}
\title{Add attachments to a message object}
\usage{
attachment(
msg,
path,
name = NA,
type = NA,
cid = NA,
disposition = "attachment"
)
}
\arguments{
\item{msg}{A message object.}
\item{path}{Path to file.}
\item{name}{Name to be used for attachment (defaults to base name of \code{path}).}
\item{type}{MIME type or \cite{NA}, which will result in a guess based on file extension.}
\item{cid}{Content-ID or \code{NA}.}
\item{disposition}{How is attachment to be presented (\code{"inline"} or \code{"attachment"})?}
}
\value{
A message object.
}
\description{
Add attachments to a message object
}
\examples{
path_mtcars <- tempfile(fileext = ".csv")
path_scatter <- tempfile(fileext = ".png")
path_cats <- system.file("cats.jpg", package = "emayili")
write.csv(mtcars, path_mtcars)
png(path_scatter)
plot(1:10)
dev.off()
msg <- envelope() \%>\%
attachment(path_mtcars) \%>\%
# This attachment will have file name "cats.jpg".
attachment(path_cats, name = "cats.jpg", type = "image/jpeg") \%>\%
attachment(path_scatter, cid = "scatter")
file.remove(path_scatter, path_mtcars)
}
emayili/man/raw.Rd 0000644 0001762 0000144 00000000614 14611676075 013554 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/address.R
\name{raw}
\alias{raw}
\title{Extract raw email address}
\usage{
raw(addr)
}
\arguments{
\item{addr}{An \code{address} object.}
}
\value{
A raw email address.
}
\description{
Strips the display name off an email address (if present).
}
\examples{
gerry <- as.address("Gerald ")
raw(gerry)
}
emayili/man/as.character.MIME.Rd 0000644 0001762 0000144 00000000602 14611676075 016044 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mime.R
\name{as.character.MIME}
\alias{as.character.MIME}
\title{Convert MIME object to character vector}
\usage{
\method{as.character}{MIME}(x, ...)
}
\arguments{
\item{x}{MIME object}
\item{...}{Further arguments passed to or from other methods.}
}
\description{
Convert MIME object to character vector
}
emayili/man/text.Rd 0000644 0001762 0000144 00000003722 14611676075 013752 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/body.R
\name{text}
\alias{text}
\title{Add a text body to a message.}
\usage{
text(
msg,
content,
disposition = "inline",
charset = "utf-8",
encoding = "7bit",
language = FALSE,
interpolate = TRUE,
.open = "{{",
.close = "}}",
.envir = NULL
)
}
\arguments{
\item{msg}{A message object.}
\item{content}{A string of message content.}
\item{disposition}{Should the content be displayed inline or as an
attachment? Valid options are \code{"inline"} and \code{"attachment"}. If
set to \code{NA} then will guess appropriate value.}
\item{charset}{What character set is used. Most often either \code{"UTF-8"}
or \code{"ISO-8859-1"}.}
\item{encoding}{How content is transformed to ASCII. Options are
\code{"7bit"}, \code{"quoted-printable"} and \code{"base64"}. Use \code{NA}
or \code{NULL} for no (or "identity") encoding.}
\item{language}{Language of content. If \code{FALSE} then will not include
language field. If \code{TRUE} then will attempt to auto-detect language.
Otherwise will use the specified language.}
\item{interpolate}{Whether or not to interpolate into input using \link[glue]{glue}.}
\item{.open}{The opening delimiter.}
\item{.close}{The closing delimiter.}
\item{.envir}{Environment used for \code{glue} interpolation. Defaults to \code{parent.frame()}.}
}
\value{
A message object.
}
\description{
Add \code{text/plain} content to a message.
}
\details{
The \code{text/plain} format is
described in \href{https://www.ietf.org/rfc/rfc2646.txt}{RFC 2646}.
Uses \code{glue::glue()} to evaluate expressions enclosed in brackets as R code.
}
\examples{
msg <- envelope() \%>\% text("Hello!")
# Using {glue} interpolation.
#
name <- "Alice"
msg <- envelope() \%>\% text("Hello {name}.")
print(msg, details = TRUE)
# Disable {glue} interpolation.
#
msg <- envelope() \%>\% text("This is a set: {1, 2, 3}.", interpolate = FALSE)
}
\seealso{
\code{\link{html}}, \code{\link{render}}
}
emayili/man/validate.Rd 0000644 0001762 0000144 00000001101 14611676075 014544 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/address.R
\name{validate}
\alias{validate}
\title{Validate email address}
\usage{
validate(addr, deliverability = TRUE)
}
\arguments{
\item{addr}{An email address.}
\item{deliverability}{Whether to check for deliverability (valid domain).}
}
\value{
A \code{logical} indicating whether or not the address is valid.
}
\description{
Validate email address
}
\examples{
# A valid address.
validate("cran-sysadmin@r-project.org")
# An invalid address.
validate("help@this-domain-does-not-exist.com")
}
emayili/man/domain.Rd 0000644 0001762 0000144 00000000540 14611676075 014230 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/address.R
\name{domain}
\alias{domain}
\title{Extract domain of email address}
\usage{
domain(addr)
}
\arguments{
\item{addr}{An \code{address} object.}
}
\value{
A character vector.
}
\description{
Extract domain of email address
}
\examples{
domain("alice@example.com")
}
emayili/man/as.address.Rd 0000644 0001762 0000144 00000001223 14611676075 015007 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/address.R
\name{as.address}
\alias{as.address}
\title{Create an address object}
\usage{
as.address(addr, validate = FALSE)
}
\arguments{
\item{addr}{An email address.}
\item{validate}{Whether to validate the address.}
}
\value{
A list of \code{address} objects.
}
\description{
Create an address object
}
\examples{
as.address("gerry@gmail.com")
as.address("Gerald ")
as.address(c("Gerald ", "alice@yahoo.com", "jim@aol.com"))
as.address("Gerald , alice@yahoo.com, jim@aol.com")
as.address("Durrell, Gerald ")
}
emayili/man/subject.Rd 0000644 0001762 0000144 00000002440 14611676075 014421 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/header-mail.R
\name{subject}
\alias{subject}
\title{Add or query subject of message.}
\usage{
subject(
msg,
subject = NULL,
prefix = NA,
suffix = NA,
interpolate = TRUE,
.open = "{{",
.close = "}}",
.envir = NULL
)
}
\arguments{
\item{msg}{A message object.}
\item{subject}{A subject for the message.}
\item{prefix}{A subject prefix.}
\item{suffix}{A subject suffix.}
\item{interpolate}{Whether or not to interpolate into input using \link[glue]{glue}.}
\item{.open}{The opening delimiter.}
\item{.close}{The closing delimiter.}
\item{.envir}{Environment used for \code{glue} interpolation. Defaults to \code{parent.frame()}.}
}
\value{
A message object or the subject of the message object (if \code{subject} is \code{NULL}).
}
\description{
Add or query subject of message.
}
\details{
The \code{prefix} and \code{suffix} can be used to add extra
\href{https://en.wikipedia.org/wiki/List_of_email_subject_abbreviations}{subject
abbreviations}.
}
\examples{
# Create a message and set the subject
msg <- envelope() \%>\% subject("Updated report")
# Retrieve the subject for a message
subject(msg)
}
\seealso{
\code{\link{to}}, \code{\link{from}}, \code{\link{cc}}, \code{\link{bcc}} and \code{\link{reply}}
}
emayili/man/cleave.Rd 0000644 0001762 0000144 00000000670 14611676075 014224 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/address.R
\name{cleave}
\alias{cleave}
\title{Split a compound address object}
\usage{
cleave(addr)
}
\arguments{
\item{addr}{An \code{address} object.}
}
\value{
A list of \code{address} objects, each of which contains only a single
address.
}
\description{
Split a compound address object
}
\examples{
cleave(as.address(c("foo@yahoo.com", "bar@yahoo.com")))
}
emayili/man/envelope.Rd 0000644 0001762 0000144 00000003652 14611676075 014605 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/envelope.R
\name{envelope}
\alias{envelope}
\title{Create a message.}
\usage{
envelope(
to = NULL,
from = NULL,
cc = NULL,
bcc = NULL,
reply = NULL,
subject = NULL,
importance = NULL,
priority = NULL,
text = NULL,
html = NULL,
encrypt = FALSE,
sign = FALSE,
public_key = FALSE
)
}
\arguments{
\item{to}{See \code{\link[=to]{to()}}.}
\item{from}{See \code{\link[=from]{from()}}.}
\item{cc}{See \code{\link[=cc]{cc()}}.}
\item{bcc}{See \code{\link[=bcc]{bcc()}}.}
\item{reply}{See \code{\link[=reply]{reply()}}.}
\item{subject}{See \code{\link[=subject]{subject()}}.}
\item{importance}{See \code{\link[=importance]{importance()}}.}
\item{priority}{See \code{\link[=priority]{priority()}}.}
\item{text}{See \code{\link[=text]{text()}}.}
\item{html}{See \code{\link[=html]{html()}}.}
\item{encrypt}{Whether to encrypt the message. If \code{TRUE} then the entire
message will be encrypted using the private key of the sender.}
\item{sign}{Whether to sign the message. If \code{TRUE} then the entire
message will be signed using the private key of the sender.}
\item{public_key}{Whether to attach a public key. If \code{TRUE} then the
public key of the sender will be attached.}
}
\value{
A message object.
}
\description{
Create a message.
}
\examples{
# Create an (empty) message object.
#
msg <- envelope()
# Create a complete message object, specifying all available fields.
#
envelope(
to = "bob@gmail.com",
from = "craig@gmail.com",
cc = "alex@gmail.com",
bcc = "shannon@gmail.com",
reply = "craig@yahoo.com",
importance = "high",
priority = "urgent",
subject = "Hiya!",
text = "Hi Bob, how are you?"
)
}
\seealso{
\code{\link[=subject]{subject()}}, \code{\link[=from]{from()}}, \code{\link[=to]{to()}}, \code{\link[=cc]{cc()}}, \code{\link[=bcc]{bcc()}}, \code{\link[=reply]{reply()}} and
\code{\link[=encrypt]{encrypt()}}.
}
emayili/man/c.address.Rd 0000644 0001762 0000144 00000000776 14611676075 014642 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/address.R
\name{c.address}
\alias{c.address}
\title{Concatenate address objects}
\usage{
\method{c}{address}(...)
}
\arguments{
\item{...}{Address objects to be concatenated.}
}
\value{
An \code{address} object.
}
\description{
Concatenate address objects
}
\examples{
gerry <- as.address("Gerald ")
alice <- address("alice@yahoo.com")
jim <- address("jim@aol.com", "Jim")
c(gerry, alice)
c(gerry, c(alice, jim))
}
emayili/man/response.Rd 0000644 0001762 0000144 00000002031 14611676075 014614 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/header-mail.R
\name{response}
\alias{response}
\alias{inreplyto}
\alias{references}
\title{Add In-Reply-To and References header fields}
\usage{
inreplyto(msg, msgid, subject_prefix = "Re: ")
references(msg, msgid, subject_prefix = "Re: ")
}
\arguments{
\item{msg}{A message object.}
\item{msgid}{A message ID. This would be the contents of the \code{Message-ID}
field from another message.}
\item{subject_prefix}{Prefix to add to subject. If specified will be prepended
onto the \code{Subject} field. Set to \code{NULL} if not required.}
}
\value{
A message object.
}
\description{
Add In-Reply-To and References header fields
}
\examples{
envelope() \%>\% inreplyto("<6163c08e.1c69fb81.65b78.183c@mx.google.com>")
# Now for German.
envelope() \%>\%
inreplyto("6163c08e.1c69fb81.65b78.183c@mx.google.com", "AW: ")
# And also for Danish, Norwegian and Swedish (but not Finnish!).
envelope() \%>\%
references("6163c08e.1c69fb81.65b78.183c@mx.google.com", "SV: ")
}
emayili/man/compliant.Rd 0000644 0001762 0000144 00000001316 14611676075 014751 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/address.R
\name{compliant}
\alias{compliant}
\title{Tests whether an email address is syntactically correct}
\usage{
compliant(addr, error = FALSE)
}
\arguments{
\item{addr}{An email address.}
\item{error}{Whether to create an error if not compliant.}
}
\value{
A Boolean.
}
\description{
Checks whether an email address conforms to the \href{https://en.wikipedia.org/wiki/Email_address#Syntax}{syntax rules}.
}
\details{
An email address may take either of the following forms:
\itemize{
\item \code{local@domain} or
\item \verb{Display Name }.
}
}
\examples{
compliant("alice@example.com")
compliant("alice?example.com")
}
emayili/man/keywords.Rd 0000644 0001762 0000144 00000001632 14611676075 014633 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/header-mail.R
\name{keywords}
\alias{keywords}
\title{Add or query keywords of message.}
\usage{
keywords(msg, ..., append = FALSE)
}
\arguments{
\item{msg}{A message object.}
\item{...}{Keywords.}
\item{append}{Whether to append or replace keywords.}
}
\value{
A message object or the comments of the message object (if \code{comments} is \code{NULL}).
}
\description{
Add or query keywords of message.
}
\examples{
# Create a message and set the keywords.
envelope() \%>\% keywords("newsletter, marketing")
envelope() \%>\% keywords("newsletter", "marketing")
envelope() \%>\% keywords(c("newsletter", "marketing"))
# Retrieve the keywords for a message.
msg <- envelope() \%>\% keywords("newsletter, marketing")
keywords(msg)
}
\seealso{
\code{\link{to}}, \code{\link{from}}, \code{\link{cc}}, \code{\link{bcc}} and \code{\link{reply}}
}
emayili/man/figures/ 0000755 0001762 0000144 00000000000 14611676075 014137 5 ustar ligges users emayili/man/figures/emayili-hex.png 0000644 0001762 0000144 00000070220 14611676075 017061 0 ustar ligges users PNG
IHDR X .' pHYs .# .#x?v IDATxyxT, !l$@uW\.Ui[[*jUZ.j\@qZEE dȈeMΜs]\&3woy@DDDk.[ bxXlJDDDW&p7Ё>p}HqUlCiSDDD"P;HvEDD$ `=I(W9֓KqTfz^!DDDo\d`-ֿ@ӟGDDDz|s0ҿꀫ~HO(EDDdW_
W#|`_X'
[DDD]n逰_H 1rF/+t@X1ND?/p0dh(2¿hտQ_ ;L}*/5&y
"^`_S}r)xهN_:6P15K`?x4,,"(DmXNHb1Rp/p'tcxV6 *c],"QD@$Axڍ$fCAj.;4j CR]EEoD83U4h/^Oȃ\
!6(>\ **"` bCNf7u \gr=1ؾq
na"e[ہvEgDS8Cߋ.AGS/œn5|ж+e˱6'>btHK:7H3U4cMJR+?fX,*"` ҿN*;IגXS%{,ROzc]ǰl2UTDvN@uhS=)3r=7T>i-3i?&amʼ. n ~.7هFѤkg)iZ7(f:j*LxdQ6H .º'T=xu$idlz*_|`Gүa^aXD;^
)pهndHųwQLz`(08TAwb2y/ĝ`"D[]Fٓв&