This uses Mailgun to send emails. It calls an R script that posts the message to MailGuns API.

cr_buildstep_mailgun(
  message,
  to,
  subject,
  from,
  mailgun_url = "$_MAILGUN_URL",
  mailgun_key = "$_MAILGUN_KEY",
  ...
)

Arguments

message

The message markdown

to

to email

subject

subject email

from

from email

mailgun_url

The Mailgun API base URL. Default assumes you set this in Build substitution macros

mailgun_key

The Mailgun API key. Default assumes you set this in Build substitution macros

...

Other arguments passed to cr_buildstep_r

Details

Requires an account at Mailgun: https://mailgun.com Pre-verification you can only send to a whitelist of emails you configure - see Mailgun website for details.

Examples

cr_project_set("my-project")
#>  2022-03-26 19:55:50 > ProjectId set to my-project
#> [1] "my-project"
cr_bucket_set("my-bucket")
#>  2022-03-26 19:55:50 > Bucket set to my-bucket
#> [1] "my-bucket"
mailgun_url <- "https://api.mailgun.net/v3/sandboxXXX.mailgun.org"
mailgun_key <- "key-XXXX"
if (FALSE) {
# assumes you have verified the email
cr_build(
  cr_build_yaml(
    steps = cr_buildstep_mailgun(
      "Hello from Cloud Build",
      to = "me@verfied_email.com",
      subject = "Hello",
      from = "googleCloudRunner@example.com"
    ),
    substitutions = list(
      `_MAILGUN_URL` = mailgun_url,
      `_MAILGUN_KEY` = mailgun_key
    )
  )
)
}