title: mailR: Sending mail to multiple addresses from shiny
body: <p>I am trying to send a mail from my Shiny app.  I have created text input boxes for to address, subject and body of the mail.  The app sends mail when I my input in textInput box is a single email Id.   When I add the second email id, it fails.  However, the same code when I try to run it from RStudio instead of a shiny app, I am able to send the emails.  How do I make my textInput parse the email id correctly so that mailR sends mail to them?</p>
  
  <p>My current code:</p>
  
  <pre><code>library(shiny)
  library(mailR)
  
  ui =fluidPage(
          fluidRow(
          div(id = "login",
               wellPanel(title = "Mail your report", 
                  textInput("to", label = "To:", placeholder = "To:"),
                  textInput("sub","Subject:"),
                  textInput("msg","Message:"),
                  actionButton("mailButton",label = "Send mail") 
                   )
              ))
  )
  server = function(input, output, session) {
   observeEvent(input$mailButton,{
                  isolate({
                    send.mail(from = "myemail@gmail.com",
                    to = input$to,
                    subject = input$sub,
                    body = input$msg,
                    smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "myemail@gmail.com", passwd = "mypasword", ssl = TRUE),
                    authenticate = TRUE,
                    html = TRUE,
                    send = TRUE)
                  })
              })
  
          }
  
  runApp(list(ui = ui, server = server))
  </code></pre>
  
  <p>I am getting the following error:</p>
  
  <pre><code>Listening on http://127.0.0.1:3499
  javax.mail.internet.AddressException: Illegal address in string ``email1@gmail.com, email2@gmail.com''
      at javax.mail.internet.InternetAddress.&lt;init&gt;(InternetAddress.java:114)
  NULL
  Warning: Error in : AddressException (Java): Illegal address
  Stack trace (innermost first):
      83: &lt;Anonymous&gt;
      82: signalCondition
      81: doWithOneRestart
      80: withOneRestart
      79: withRestarts
      78: message
      77: value[[3L]]
      76: tryCatchOne
      75: tryCatchList
      74: tryCatch
      73: .jTryCatch
      72: .valid.email
      71: send.mail
      64: isolate
      63: observeEventHandler [#3]
       1: runApp
  ERROR: [on_request_read] connection reset by peer
  </code></pre>