R/create_credentials.R
create_smtp_creds_key.RdWe can set SMTP access credentials in the system-wide key-value store for the
purpose of more easily sending email messages through smtp_send(). With
this key added, the credentials helper creds_key() can be used in the
credentials argument of smtp_send() (the id value is used to
unambiguously refer to each key).
create_smtp_creds_key( id, user = NULL, provider = NULL, host = NULL, port = NULL, use_ssl = NULL, overwrite = FALSE )
| id | An identifying label for the keyname. The full key name is
constructed in the following way: |
|---|---|
| user | The username for the email account. Typically, this is the email address associated with the account. |
| provider | An optional email provider shortname for autocompleting SMTP
configuration details (the |
| host | Configuration info for the SMTP server. The |
| port | Configuration info for the SMTP server. The |
| use_ssl | Configuration info for the SMTP server. The |
| overwrite | An option that controls the overwriting of existing keys
with the same |
Support for setting keys through create_smtp_creds_key() is provided
through the keyring package. This function cannot be used without that
package being available on the system. We can use
install.packages("keyring") to install keyring.
# Store SMTP credentials using the # system's secure key-value store to # make it much easier to send email # out through Gmail with `smtp_send()`; # provide the `id` of "gmail_creds" # create_smtp_creds_key( # id = "gmail_creds", # provider = "gmail", # user = "user_name@gmail.com", # )