Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JohnCoene/mjml
📨 Create responsive emails with R
https://github.com/JohnCoene/mjml
email mjml r rstats
Last synced: 3 months ago
JSON representation
📨 Create responsive emails with R
- Host: GitHub
- URL: https://github.com/JohnCoene/mjml
- Owner: JohnCoene
- License: other
- Created: 2018-03-03T17:15:18.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-15T15:15:27.000Z (over 4 years ago)
- Last Synced: 2024-05-01T15:29:49.952Z (6 months ago)
- Topics: email, mjml, r, rstats
- Language: R
- Homepage:
- Size: 139 KB
- Stars: 13
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-shiny-extensions - mjml - Create responsive emails with R and MJML. (Backend / Notification Integration)
- jimsghstars - JohnCoene/mjml - 📨 Create responsive emails with R (R)
README
[![Travis-CI Build Status](https://travis-ci.org/JohnCoene/mjml.svg?branch=master)](https://travis-ci.org/JohnCoene/mjml)
# mjml
Easily create responsive emails with [MJML](https://mjml.io/).
- [mjml](#mjml)
- [Install](#install)
- [Templates](#templates)
- [Example](#example)## Install
Install the package.
``` r
# install.packages("remotes")
remotes::install_github("JohnCoene/mjml")
```Installs [MJML](https://mjml.io/) _globally_, this should only be run once on your machine.
```r
library(mjml)install_mjml()
```If the installation is successful the following should work.
```r
mjml::find_mjml()
```## Templates
Insert templates with RStudio addin.
* `Allura`
* `Happy New Year`
* `Card`
* `Proof`
* `Droids`## Example
load the library then use then build an email using the mjml tags, similar to htmltools.
```r
library(mjml)# create email
email <- mj_ml(
mj_head(
mj_preview("Preview text")
),
mj_body(
mj_container(
mj_section(
mj_column(
width = "20%",
mj_text("Content of the first column")
),
mj_column(
width = "80%",
mj_text("Content of the second, wider, column")
)
),
mj_section(
mj_column(
mj_image(
"https://www.r-project.org/Rlogo.png"
)
)
)
)
)
)
```Send email with [sendmailR](https://CRAN.R-project.org/package=sendmailR), the convenience function `mj_sendmailr` converts the mjml tags into a html read in R.
```r
library(sendmailR)msg <- mj_sendmailr(email)
sendmail(
from = "[email protected]",
to = "[email protected]",
subject = "testing",
msg = msg,
control = list(
smtpServer = "mail.google.com"
)
)
```