Created
June 3, 2020 15:54
-
-
Save jimbrig/964b0bd05c8e736bcb1d95cc4ca1f9d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------------------------------------------------------------------------ | |
# | |
# Title : Emailing with RDCOMClient Walkthrough Script | |
# By : Jimmy Briggs <[email protected]> | |
# Date : 2020-06-03 | |
# | |
# ------------------------------------------------------------------------ | |
# install RDCOMClient package: | |
# Run the following to install the stable version from CRAN: | |
install.packages("RDCOMClient") | |
# or from the Omegahat repository | |
install.packages("RDCOMClient", repos = "http://www.omegahat.net/R") | |
# Alternatively, you can build the package from source without much difficulty. | |
# With Rtools installed, one can build the package from source without the need | |
# for any third-party libraries. | |
# From the (Windows) command line | |
# R CMD INSTALL RDCOMClient | |
# or using devtools | |
devtools::install_github("omegahat/RDCOMClient") | |
# --------------------------------------------------------------------------- | |
library(RDCOMClient) | |
# initialize email via command line: | |
OutApp <- COMCreate("Outlook.Application") | |
outMail <- OutApp$CreateItem(0) | |
# fill in adressee(s), subject, and body | |
outMail[["To"]] = "<email_address>" | |
outMail[["subject"]] = "<email subject>" | |
outMail[["body"]] = "<email_body>" | |
# add an attachment: | |
outMail[["Attachments"]]$Add("<email_attached_file>") | |
# send | |
outMail$Send() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment