Closed DavidL-H closed 2 years ago
Package 'email' not available in repository or locally
Looks like somewhere in the files which you are uploading to shinyapps.io you're referring to a package called "email". That's not an {emayili} problem though...
Thanks for the quick answer. I don't have much experience with Shiny apps, so sorry if this is the wrong place for the issue. But error message comes only when I have library(emayili)
in the app (see steps to reproduce above). Nothing else is called other than ibrary(shiny)
. When I comment out the library call and code related to emayili, it deploys just fine:
library(shiny)
#library(emayili)
# Define server logic required to draw a histogram
shinyServer(function(input, output) {
observeEvent(input$SendEmail,{
# smtp <- server(
# host = "smtp.gmail.com",
# port = 465,
# username = "my gmail account",
# password = "my password"
# )
#
# email <- envelope()
# email <- email %>%
# from("my gmail account") %>%
# to("recipient")%>%
# subject(paste("Test email"))%>%
# text("This work locally, but cannot be deployed too shinyapps.io")
#
# smtp(email, verbose = TRUE)
})
})
Sorry, but it seems to work for me. I've used the code you supplied and deployed to shinyapps.io. Evidently there's something in your project that is not included in the initial information that you sent me (the ui.R
and server.R
files).
Yeah, must be another issue then. Thanks for your quick help!
Do you have any other files in this project? Or is it just the ui.R
and server.R
files? And are they verbatim copies of the code that you provided in the original question?
I'm trying to use the emayili package for a larger shiny project, the deloyment of which stopped working when I included emayili. For the reproducible example I posted above, I have nothing else in the project, just the ui and server files. They are verbatim copies of what I posted.
Hi @DavidL-H, I'd like to help you resolve this problem. Do you have time for a quick call sometime this week? I'm full committed for the next two days, but I'll have time on Wednesday. Thanks, Andrew.
Thanks you very much for the offer @datawookie, I appreciate it, but I actually just found a work around, and now it works.
The original server.R
library(shiny)
library(emayili)
shinyServer(function(input, output) {
observeEvent(input$SendEmail,{
smtp <- server(
host = "smtp.gmail.com",
port = 465,
username = "my gmail account",
password = "my password"
)
email <- envelope()
email <- email %>%
from("my gmail account") %>%
to("recipient")%>%
subject(paste("Test email"))%>%
text("This work locally, but cannot be deployed too shinyapps.io")
smtp(email, verbose = TRUE)
})
})
Gave an error when deploying to shiny, that it could not find package email
. After some testing, it seems that shiny thinks that the email
object being assigned the mail which is sent emayili, is a package, for some reason that I still don't understand. Changing the server.R
to:
library(shiny)
library(emayili)
shinyServer(function(input, output) {
observeEvent(input$SendEmail,{
smtp <- server(
host = "smtp.gmail.com",
port = 465,
username = "my gmail account",
password = "my password"
)
another_name<- envelope()
another_name<- another_name%>%
from("my gmail account") %>%
to("recipient")%>%
subject(paste("Test email"))%>%
text("This work locally, but cannot be deployed too shinyapps.io")
smtp(another_name, verbose = TRUE)
})
})
gave the following error:
Preparing to deploy application...DONE
Uploading bundle for application: 6506012...Error: Unable to retrieve package records for the following packages:
- "another_name"
In addition: Warning message:
In FUN(X[[i]], ...) :
Package 'another_name' not available in repository or locally
Execution halted
However, to work around this I changed the code to:
library(shiny)
library(emayili)
shinyServer(function(input, output) {
observeEvent(input$SendEmail,{
smtp <- server(
host = "smtp.gmail.com",
port = 465,
username = "my gmail account",
password = "my password"
)
emayili<- envelope()
emayili<- emayili%>%
from("my gmail account") %>%
to("recipient")%>%
subject(paste("Test email"))%>%
text("I can now deploy my app to shinyapps.io")
smtp(emayili, verbose = TRUE)
})
})
And now the app deploys to shinyapps.io just fine and is working as expected. Weird.
Very weird indeed. Well the original code worked fine for me (locally and on shinyapps). I'm guessing that we might be seeing different versions of shinapps (maybe they are doing some beta testing?). Your hack is very clever... but I think that this immediately indicates that something weird is going on in shinyapps and this is not an {emayili}
issue!
Hi, I am trying to build an app to send email. I copied and paste this code to see if it works. Well, it doesn't work locally. I am getting this error:
Warning: Error in server: unused arguments (host = "smtp.gmail.com", port = 465...) 1: runApp
Do you know what it may be? Thanks
Hi @andresimi, please can you create a new issue since this one is closed. Also, please can you provide:
{emayili}
package.Thanks, Andrew.
@datawookie thank you, i just did it
Description of the bug
I have a shiny app that uses Emayili. When I run it locally, it works as expected, but when I try to deploy it to my shinyapps.io account, it gives this error message:
Maybe I am missing something basic, but don't under why the error message is refering to a package "email" that is not installed.
Steps To Reproduce
ui.R
server.R
Additional Information
sessionInfo()