Hello!
I have problem with sending message.
My code is:
Properties props = new Properties();
props.put("mail.smtp.host", "mail.my.pl");
Session session = Session.getDefaultInstance(props, null);
MimeMessage message = new MimeMessage(session);
message.setText("message text");
message.setSubject("message subject");
Address addressFrom = new InternetAddress("p.lizurek@spot.pl");
Address addressTo = new InternetAddress("inny@spot.pl");
message.setFrom(addressFrom);
message.addRecipient(Message.RecipientType.TO, addressTo);
Transport.send(message);
When I try to send this message, I get this Exception:
13:36:09,500 INFO [STDOUT] javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 450 <frodo>: Helo command rejected: Host not found
13:36:09,500 INFO [STDOUT] at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1196)
13:36:09,500 INFO [STDOUT] at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:584)
13:36:09,500 INFO [STDOUT] at javax.mail.Transport.send0(Transport.java:169)
13:36:09,500 INFO [STDOUT] at javax.mail.Transport.send(Transport.java:98)
13:36:09,500 INFO [STDOUT] at pl.spot.onecom.onebox.web.action.SendMailAction.execute(SendMailAction.java:72)
...
...
...
Please, help me! The host, mail.my.pl, exist, but I get message that this host cant be found. What is going on?