I was using the following code on my previous server and that was working very well
import java.io.*;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.mail.event.*;
import java.net.*;
import javax.activation.*;
public class sendEmail {
public static void send(String from, String to,
String subject, String content)
throws AddressException, MessagingException {
Properties props=new Properties();
props.put("smtp.domainName.com","hostname");
Session session1 = Session.getDefaultInstance(props,null);
Message msg =new MimeMessage(session1);
msg.setFrom(new InternetAddress(from));
msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to,false));
msg.setSubject(subject);
msg.setContent(content,"text/html");
Transport.send(msg);
}
}
Now I changed the "smtp.domainName.com","hostname" to "IP","IP" the new server it displays following error:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
* com.sun.mail.smtp.SMTPAddressFailedException: 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.5.3 - chkuser)*
I edited my /var/qmail/control/rcpthosts and inserted my whole domain names but still I am receiving the same error. My network company replied me that previous server was using the open relay but now we have to change the code to send the emails
How can I resolve the issue?
Thanks and best regards