I am getting this error only when I try to send mail using javax library. If i send it from my mail client, it works fine.
Properties properties = new Properties();
properties.put("mail.transport.protocol", "smtp");
properties.put("mail.smtp.host",server); // smtp.gmail.com?
//properties.put("mail.smtp.port", "25");
properties.put("mail.smtp.auth", "true");
Authenticator authenticator = new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, pass);
}
};
Session session = Session.getDefaultInstance(properties, authenticator);
Message message =new MimeMessage(session);
message.setFrom(new InternetAddress("alert@test.com"));
message.setRecipients(Message.RecipientType.TO,InternetAddress.parse("alert1@test.com",false));
message.setSubject("test");
message.setText("hi");
Transport.send(message);
System.out.println("mail sernt");
I went through these posts, https://stackoverflow.com/questions/24688111/smtp-554-analysis ,SMTP: Error 554, message is not RFC compliant , What does props.put("mail.smtp.host", host) in JavaMail do? All of these seem to suggest that IP address may be blocked / something related to SMTP. However, my mail client works fine. Is that related to SMTP config or have I missed something .?
When I try to debug, I get file not found exception for : jre1.6.0\lib\javamail.providers and javamail.address.map. Is that related to these exceptions. Also how do I check if my firewall is not the problem.