There following code is pieces from jsp.
It compiled with no error.
It runs successfully sent email to my email address, BUT sometimes it cannot.
why it cannot ? How to removed my ip address from blacklist ? how to solve this problem ?
Here is the message from console :
Exception --> javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
javax.mail.SendFailedException: 554 The IP Address of the sender (60.xx.22.oo) was found in a DNS blacklist database and was therefore refused.
Expand|Select|Wrap|Line Numbers
- String subject = "This is subject ";
- String message = "";
- String to = "sheng@xxx.com.my";
- String from = "info@yyy.com.my";
- try {
- Properties props = new Properties();
- props.put("mail.smtp.host","mail.asiam.com.my");
- Session ss = Session.getDefaultInstance(props, null);
- MimeMessage msg = new MimeMessage(ss);
- InternetAddress addressfrom = new InternetAddress(from);
- msg.setFrom(addressfrom);
- InternetAddress addressTo = new InternetAddress(to);
- msg.addRecipient(Message.RecipientType.TO, addressTo);
- message = "Name : " + name +
- "\n" + "Address : " + address;
- msg.setSubject(subject);
- msg.setContent(message, "text/plain");
- Transport.send(msg);