Help Commons-Mail Mass Mailing

-1

Hello

I am testing a code that I plan to implement soon.

The question is about SimpleEmail from the commons-mail library.

When I use it to send e-mail by typing directly into the code. So:

SimpleEmail email = new SimpleEmail();
        email.setFrom("[email protected]", "Ítalo");
        email.setSubject("Testando Email Via Commons Em Massa");
        email.setMsg("Teste efetuado com sucesso !");
        email.setSSLOnConnect(true);
        email.setAuthentication(emailtexto, "xxxxxxx");
        email.setHostName("mail.gmx.com");
        email.setSmtpPort(465);
        email.addTo("[email protected]", "Italo");
        email.send();

It sends correctly, however if I use a variable instead of pure typed text.

    SimpleEmail email = new SimpleEmail();
    email.setFrom("[email protected]", "Ítalo");
    email.setSubject("Testando Email Via Commons Em Massa");
    email.setMsg("Teste efetuado com sucesso !");
    email.setSSLOnConnect(true);
    email.setAuthentication(emailtexto, "xxxxxxx");
    email.setHostName("mail.gmx.com");
    email.setSmtpPort(465);
    email.addTo(emailtexto); // Variável contendo endereço de e-mail.
    email.send();

In this way the code throws an Exception:

org.apache.commons.mail.EmailException: Sending the email to the following server failed : mail.gmx.com:465
    
asked by anonymous 27.12.2018 / 19:01

0 answers