Ich versuche, eine Seite zu erstellen, die eine E-Mail mit Anhang auf Play Framework sendet. Ich muss zuerst wissen, wie man eine einfache E-Mail sendet. Ich folge Apache Commons Userguide for Email.Play Framework Senden von E-Mail mithilfe von Apache Commons
Email email = new SimpleEmail();
email.setHostName("smtp-mail.outlook.com");
email.setSmtpPort(587);
email.setAuthenticator(new DefaultAuthenticator("[email protected]", "password"));
email.setSSLOnConnect(true);
email.setFrom("[email protected]");
email.setSubject("Subject");
email.setMsg("This is a test mail ... :-)");
email.addTo("[email protected]");
email.send();
Execution Ausnahme: [EmailException: Sending the email to the following server failed : smtp-mail.outlook.com:465]
Ich weiß nicht, warum sagt es 465
auch ich gesetzt Port als 587
Ausnahme auf Terminal: Caused by: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp-mail.outlook.com, 465; timeout 60000;
Was ist der Grund, dass Programm akzeptiert Portnummer als 465
.
gleiche Problem tritt auch auf, wenn ich gmail verwenden