Hi Stefan,

the error message indicates that the SMTP server is not responding on the port

Only the methods are deprecated and not the functionality ... :-) ... for an explaination please see https://issues.apache.org/jira/browse/EMAIL-105

So the methods would be

* setSSLOnConnect - Sets whether SSL/TLS encryption should be enabled for the SMTP transport upon connection (SMTPS/POPS)
* setStartTLSRequired - Set or disable the required STARTTLS encryption

in both cases you wold use a secured connection for sending emails

Cheers,

Siegfried Goeschl

On 25.08.12 22:48, Stefan at WPF wrote:
Hello Siegfried,

thank you for your reply. Today I finally had the chance to test 1.3.
I tried sending a mail using TLS, however I always get a tiemout, here's the code:

     Email email = new SimpleEmail();
       email.setSmtpPort(465);
       email.setAuthenticator(new DefaultAuthenticator("user", "pass"));
       email.setDebug(false);
       email.setHostName("host.com <http://host.com>");
       email.setFrom("[email protected] <mailto:[email protected]>");
       email.setSubject("Hi");
       email.setMsg("This is a test mail ... :-)");
       email.addTo("[email protected] <mailto:[email protected]>");
       email.setTLS(true);
       email.send();

This gives me

    Exception in thread "main" org.apache.commons.mail.EmailException:
    Sending the email to the following server failed : host.com:465
    <http://host.com:465>
    at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1189)
    at org.apache.commons.mail.Email.send(Email.java:1214)
    at Mailtest.main(Mailtest.java:26)
    Caused by: javax.mail.MessagingException: Exception reading response;
      nested exception is:
    java.net.SocketTimeoutException: Read timed out
    at
    com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2210)
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1950)
    at
    com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:642)
    at javax.mail.Service.connect(Service.java:317)
    at javax.mail.Service.connect(Service.java:176)
    at javax.mail.Service.connect(Service.java:125)
    at javax.mail.Transport.send0(Transport.java:194)
    at javax.mail.Transport.send(Transport.java:124)
    at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1179)
    ... 2 more
    Caused by: java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:150)
    at java.net.SocketInputStream.read(SocketInputStream.java:121)
    at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
    at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:89)
    at
    com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2188)
... 10 more

Also I am wondering, what is the best way to send an email using TLS? setTLS is marked as deprecated?

Thank you very much and best regards
Stefan

2012/8/21 Siegfried Goeschl <[email protected] <mailto:[email protected]>>

    Hi Stefan,

    the vote did not pass simply because it did not attracted enough
    +1s ... :-(

    Technically the 1.3 release is the current trunk or the following
    SVN URL

    https://svn.apache.org/repos/asf/commons/proper/email/tags/EMAIL_1_3_RC3

    If you give it a try it would be highly appreciated if you write a
    quick feedback (even if it worx without issues) ... ;-)

    Cheers,

    Siegfried Goeschl


    On 15.08.12 12:20, Stefan at WPF wrote:

        Hello,

        I think I have read that 1.3 is already finished, just not yet
        released,
        because it didn't pass the voting.

        1) Anyone knows why it did not pass the voting? What's the
        problem with
        1.3?
        2) How can I find 1.3 on the SVN?

        Thanks :-)

        Best regards
        Stefan



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [email protected]
    <mailto:[email protected]>
    For additional commands, e-mail: [email protected]
    <mailto:[email protected]>



Reply via email to