Biswankar Das
Biswankar Das

Reputation: 305

Issue while sending email notification via shiny dashbaord

I am using mailR package to send email on click of a button on my shiny package. Here is what I am doing

observeEvent(input$sampleButton,{
send.mail(from="[email protected]",
          to="[email protected]",
          subject="[email protected]",
          smtp=list(host.name = '1.1.1.1',port=25),
          autheticate = FALSE,
          send=TRUE)
})

Although the mail goes through, I get the following error :

error in as.character.default(text): no method for coercing this s4 class to vector

Upvotes: 0

Views: 157

Answers (1)

Chabo
Chabo

Reputation: 3000

The to= argument is expecting a character vector, try defining the recipients before calling the send.mail function like this..

From the function information page..

observeEvent(input$sampleButton,{
 recipients <- c("[email protected]")
 send.mail(from="[email protected]",
          to=recipients,
          subject="[email protected]",
          smtp=list(host.name = '1.1.1.1',port=25),
          autheticate = FALSE,
          send=TRUE)
})

Upvotes: 1

Related Questions