rstudio / blastula

Easily send great-looking HTML email messages from R
https://pkgs.rstudio.com/blastula
Other
546 stars 84 forks source link

Version 0.3.4 fails attaching xlsx files #313

Closed rucoma closed 6 months ago

rucoma commented 11 months ago

New version 0.3.4 attaches file "Filename' instead of desired file. Downgrading to 0.3.3 works again.

Example of code:

if (nrow(alert_df) > 0) {
  bodyMessage <-  md(paste0("Alert"))

  outputXLSX <- paste0('/home/', 'alert_', Sys.Date(), '.xlsx')

  write_xlsx(x = alert_df, path = outputXLSX, format_headers = FALSE)

  mail <- compose_email(body = bodyMessage)

  attachmentList <- list(file_path = outputXLSX, 
                         content_type = mime::guess_type(outputXLSX), 
                         disposition = "attachment", 
                         filename = basename(outputXLSX))

  mail$attachments <- c(mail$attachments, list(attachmentList))

  mail %>%
    smtp_send(
      from = "me@aaa.com",
      to = "me@aaa.com",
      subject = paste0("Alert ", Sys.Date()),
      credentials = creds_file(file = "/home/blastula_outlook_creds"
      )
    )

  print('Mail sent!')
}
DDelbende commented 11 months ago

Same problem.

jpd527 commented 10 months ago

Same problem: https://github.com/rstudio/blastula/issues/314

Wezz0234 commented 10 months ago

Same problem

rich-iannone commented 10 months ago

This was recently fixed by https://github.com/rstudio/blastula/pull/316. Could you confirm this fix actually works in practice by installing the package from GitHub and testing with an xlsx attachment?

Wezz0234 commented 10 months ago

I can confirm that the GitHub version does indeed works as expected. I tried with various file types, including .xlsx, .sav, .pdf, .txt and they all attached to the email correctly. Thanks!

I assume the update will be on CRAN soon?

farshadteainc commented 9 months ago

Same problem with 0.3.4. Upgrading to dev version 0.3.4.9000 resolves the issue.

rich-iannone commented 6 months ago

Fixed in the latest CRAN release: https://github.com/rstudio/blastula/releases/tag/v0.3.5.