次のコードを使用して、Javaアプリケーションから電子メールを送信しています。私のコンピューターでは、2台目のコンピューターでも正常に動作しますが、同じ接続設定を使用しているにもかかわらず、(同じネットワーク内の)別のコンピューターでは動作しません。
public void connect() throws MessagingException
{
Authenticator auth = new Authenticator(){
@Override
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication(smtpUser, smtpPassword);
}
};
Properties props = new Properties();
props.put("mail.smtp.host", this.smtpServer);
props.put("mail.smtp.auth", true);
session = Session.getDefaultInstance(props, auth);
store = session.getStore(this.protocol);
store.connect(this.mailboxServer, this.user, this.password); //<-- exception is thrown here
}
これは私が得る例外です:
javax.mail.MessagingException: connect failed;
nested exception is:
java.net.SocketException: Permission denied: connect
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:161)
at javax.mail.Service.connect(Service.java:288)
at javax.mail.Service.connect(Service.java:169)
at com.myapp.MailboxConnection.connect(MailboxConnection.java:66)
caused by: java.net.SocketException: Permission denied: connect
1台のコンピューターで動作しない理由は何でしょうか。