Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JavaMail sending error

RaakhApr 1 2009 — edited Apr 9 2009
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 7 2009
Added on Apr 1 2009
6 comments
666 views