Giter Site home page Giter Site logo

mjml's Introduction

Travis-CI Build Status

mjml

Easily create responsive emails with MJML.

Install

Install the package.

# install.packages("remotes")
remotes::install_github("JohnCoene/mjml")

Installs MJML globally, this should only be run once on your machine.

library(mjml)

install_mjml()

If the installation is successful the following should work.

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.

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(
            paste0(
              "https://www.r-project.org/Rlogo.png"
            )
          )
        )
      )
    )
  )
)

Send email with sendmailR, the convenience function mj_sendmailr converts the mjml tags into a html read in R.

library(sendmailR)

msg <- mj_sendmailr(email)

sendmail(
  from = "[email protected]",
  to = "[email protected]",
  subject = "testing", 
  msg = msg,
  control = list(
    smtpServer = "mail.google.com"
  )
)

mjml's People

Contributors

johncoene avatar jpcoene avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.