rstudio / blastula

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

issues with filename / file extensions for attachments for v0.3.4 (works fine for v0.3.3) #319

Closed kristymazoo closed 6 months ago

kristymazoo commented 9 months ago

Hi,

I am using blastula to send emails through shiny apps. There were a couple of issues I encountered by moving to blastula v0.3.4. I was originally using v0.3.2 and then tested v0.3.3 (works) and dev version of blastula (doesn't work).

  1. when attaching an xlsx - the filename for the attached xlsx is now appearing as a generic Filename instead of the actual filename. the downloaded file has the appropriate content though.

    image
  2. when attaching an html file - same issue with the filename being displayed as Filename but then trying to preview the file in the email, it doesn't appear b/c, I believe, when downloading the file, it doesn't show up as an html extension but rather opens in textEdit (on a Mac) by default. When opening the file, the content appears correctly.

image image

Here's some sample code:

library(blastula)
library(stringr)
library(htmltools)
library(tidyverse)
# library(gt)

# tbl <- gt::gt(mtcars %>% head(5)) %>% 
#   # gt::fmt_markdown(columns = everything()) %>%
#   gt::as_raw_html()
email_body <- md(
  c("Hello all!\n", 
    # tbl, "\n",
    "Thank you.")
  )

body <- compose_email(body = email_body)
subject <- "Test-email"
attachment_path1 <- "filepath.xlsx"
attachment_path2 <- "filepath.html"

body %>%
  add_attachment(
    file = attachment_path1) %>%
  smtp_send(
    from = "<outlook-email>",
    to = "<outlook-email>",
    subject = subject,
    credentials = blastula::creds_anonymous(host = "XX", port = XX, use_ssl = FALSE)
  )

Thanks, Kristy

rsh52 commented 9 months ago

I can confirm I'm running into the same issue, CSV reports that were working are coming back as Filename with no extension. Rolling back to 0.3.3 resolves.

rich-iannone commented 9 months ago

There was a recent fix for this, https://github.com/rstudio/blastula/pull/316, which is now part of the dev version. Could you try again with the dev version and see if that resolves the problem? Otherwise, more work needs to be done here (if it doesn't work) or a release to CRAN is needed (if it does work).

rsh52 commented 9 months ago

There was a recent fix for this, #316, which is now part of the dev version. Could you try again with the dev version and see if that resolves the problem? Otherwise, more work needs to be done here (if it doesn't work) or a release to CRAN is needed (if it does work).

In my local testing this works off the current dev version! Thanks Rich 😄

rich-iannone commented 9 months ago

@rsh52 Thanks for verifying this, really sets my mind at ease now. Okay, time for a new CRAN release!

chuxinyuan commented 7 months ago

@rsh52 Thanks for verifying this, really sets my mind at ease now. Okay, time for a new CRAN release!

Did not see the new version released.

lindblb commented 6 months ago

This is still broke - is new version coming soon? @rich-iannone

rich-iannone commented 6 months ago

Now released to CRAN, very sorry for the delay in getting it there. But thanks for the (latest) reminder @lindblb , that got it all top-of-mind again!

ulyngs commented 2 months ago

I'm still running into problems with this -- my file attachments are all named 'Filename'...

I'm on version 0.3.5.9000

dhillary-ias commented 1 month ago

I also still have this issue with 0.3.5 - I downgraded to 0.3.3 and it worked fine.