Add a local image inside the body of the email with this helper function.
A path to an image file.
Text description of image passed to the alt
attribute inside of
the image (<img>
) tag for use when image loading is disabled and on
screen readers. NULL
default produces blank (""
) alt text.
The width to be used for the image, in pixels.
The alignment to be used for the image. If not "inline"
, the
image will appear in its own block, i.e. there will not be text to the left
or right of it.
The float value to be used for the image. If not "none"
, text
will flow around the image, and the align
argument will be ignored.
A character object with an HTML fragment that can be placed inside the message body wherever the image should appear.
# Create an HTML fragment that
# contains an image
img_file_path <-
system.file(
"example_files",
"test_image.png",
package = "blastula"
)
img_file_html <-
add_image(file = img_file_path)
# Include the image in the email
# message body by simply referencing
# the `img_file_html` object
email <-
compose_email(
body = md(
c(
"Hello,
Here is an image:\n",
img_file_html
)
)
)
if (interactive()) email