このエラーは私を夢中にさせています。アプリケーションが例外をスローしたときに自分自身にメールを送信しようとしていますが、このエラーが発生し始めました。ホストに正常に ping を実行でき、nslookup を使用するとローカル IP アドレスを取得できます。何か案は?ありがとう
try
{
java.util.Date d = new Date();
Properties props = new Properties();
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", "My server address");
props.setProperty("mail.smtp.auth", "true");
props.setProperty("mail.smtp.port", "25");
Authenticator authenticator = new SmtpAuthenticator();
Session mailSession = Session.getDefaultInstance(props, authenticator);
Transport transport = mailSession.getTransport();
MimeMessage message = new MimeMessage(mailSession);
message.setFrom(new InternetAddress("My email"));
message.setSubject("Voicemail Notification");
message.setContent("You are receiving this automatic message because there has been a voicemail left in the system on " +d.toString() + " for the division of the company you work for. \n" +
"Please respond promptly. Thanks!\n" +
"Private Ip address?file=" + messageName + ".gsm", "text/plain");
message.addRecipient(Message.RecipientType.TO, new InternetAddress(emailTo));
transport.connect();
transport.sendMessage(message,
message.getRecipients(Message.RecipientType.TO));
transport.close();
System.out.println("Email Sent!");
}
catch(Exception ex)
{
ex.printStackTrace();
System.out.println("Unable to send email notification to: " + emailTo);
}