
Last chance! 50% off unlimited learning
Sale ends in
Create the HTML fragment for a call to action button. This can be used as
part of the email body but, since this HTML, it must be contained within
md()
. There are options to specify the button text, the URL, and the
button's alignment.
add_cta_button(url, text, align = "center")
A character object with an HTML fragment that can be placed inside the message body wherever the CTA button should appear.
A URL for the button.
The text that is placed atop the CTA button.
The alignment of the button inside the main content area.
Options are "center"
(the default), "left"
, and "right"
.
# Create the button as an HTML fragment
cta_button <-
add_cta_button(
url = "http://www.website.net",
text = "Press This Button"
)
# Include the button in the email
# message body by using it as part of
# a vector inside of `md()`
email <-
compose_email(
body = md(
c(
"Pressing the button will take
you to an example website",
cta_button
)
)
)
if (interactive()) email
Run the code above in your browser using DataLab