1
添付ファイル付きの電子メールをPlay Frameworkに送信するページを作成しようとしています。私はまず簡単な電子メールを送る方法を知る必要があります。私は次のとおりです Apache Commons Userguide for Email。Play Framework 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();
実行例外:プログラムが受け入れる理由は何Caused by: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp-mail.outlook.com, 465; timeout 60000;
:[EmailException: Sending the email to the following server failed : smtp-mail.outlook.com:465]
それは465
でも私は、端末上の587
例外としてポートを設定すると言う理由を私は知りませんポート番号は465
です。私はGmailの