1

I have the following code:

 text <- 'sample'

 sender <- "***"
 recipients <- c("***")
 send.mail(from = sender,
      to = recipients,
      subject = text,
      body = text,
      smtp = list(host.name = "smtp.gmail.com", port = 465,
                  user.name = "***",           
                  passwd = "***", ssl = TRUE),
      authenticate = TRUE,
      send = TRUE)

The text variable is in my case a value that is fetched from a database but this makes it easier. The code above works fine when I run it on my local machine. However when I run it on Linux Ubuntu the exact same code gives me the following error:

 org.apache.commons.mail.EmailException: Sending the email to the following  
 server failed :     smtp.gmail.com:465
    at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1410)
    at org.apache.commons.mail.Email.send(Email.java:1437)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.                                                       java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces                                                       sorImpl.java:43)

Can anybody tell me what could be the reason that I get this error on Linux enviroment (and not when I run it local)?

Frits Verstraten
  • 2,049
  • 7
  • 22
  • 41

0 Answers0