Connecting Tech Pros Worldwide Forums | Help | Site Map

Errors with Java Mail Programming.

dmjpro's Avatar
Lives Here
 
Join Date: Jan 2007
Location: India (West-Bengal)
Posts: 2,451
#1: Jul 24 '08
I am using SMTP mail server.
I am sending a mail from SMTP client using Java Mail.
But now i am getting this exception...

Relaying denied. IP name possibly forged

The debug informations given below ....
"DEBUG: setDebug: JavaMail version 1.4.1
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "iem.iitkgp.ernet.in", port 25, isSSL false
220 iem.iitkgp.ernet.in ESMTP Sendmail 8.12.8/8.12.8; Wed, 23 Jul 2008 17:51:36 +0530
DEBUG SMTP: connected to host "iem.iitkgp.ernet.in", port: 25

EHLO pal
250-iem.iitkgp.ernet.in Hello [10.29.33.249], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "SIZE", arg ""
DEBUG SMTP: Found extension "DSN", arg ""
DEBUG SMTP: Found extension "ETRN", arg ""
DEBUG SMTP: Found extension "DELIVERBY", arg ""
DEBUG SMTP: Found extension "HELP", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<erp@iem.iitkgp.ernet.in>
250 2.1.0 <erp@iem.iitkgp.ernet.in>... Sender ok
RCPT TO:<debasis.jana.iit@gmail.com>
550 5.7.1 <debasis.jana.iit@gmail.com>... Relaying denied. IP name lookup failed [10.29.33.249]
DEBUG SMTP: Invalid Addresses
DEBUG SMTP: debasis.jana.iit@gmail.com
DEBUG SMTP: Sending failed because of invalid destination addresses
RSET
250 2.0.0 Reset state
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 <debasis.jana.iit@gmail.com>... Relaying denied. IP name lookup failed [10.29.33.249]"

Please help me to figure out.

dmjpro's Avatar
Lives Here
 
Join Date: Jan 2007
Location: India (West-Bengal)
Posts: 2,451
#2: Jul 24 '08

re: Errors with Java Mail Programming.


Actually mail server is not supporting cross domain mail sending.
With in the same domain it is working.
But in spite of having a solution i still have a lot of problems .....

Expand|Select|Wrap|Line Numbers
  1. Properties props = new Properties();
  2.     props.put("mail.smtp.host", "iem.iitkgp.ernet.in");
  3.         props.put("mail.debug",true);
  4.  
  5.         Session session = Session.getInstance(props,new Authenticator() {
  6.             protected PasswordAuthentication getPasswordAuthentication(){
  7.                 return new PasswordAuthentication("erp@iem.iitkgp.ernet.in","erp2008");
  8.             }
  9.         });
  10.     session.setDebug(true);
  11.  
  12.         Message msg = new MimeMessage(session);
  13.     msg.setFrom(new InternetAddress("erp@iem.iitkgp.ernet.in"));
  14.     InternetAddress[] address = {new InternetAddress("debasis.jana.iit@gmail.com")};
  15.         msg.setRecipients(Message.RecipientType.TO, address);
  16.     msg.setSubject("JavaMail APIs Test");
  17.         msg.setSentDate(new Date());
  18.         msg.setText("This is a message body.\nHere's the second line.");
  19.  
  20.         Transport.send(msg);
  21.  
This is my source code.
If i change the from address to wrong address and even it is from cross domain then still it's working.
Anyway I think need to go through the details of SMTP server.
I think then i can figure out myself what's wrong with it.
I need all of your best wishes.
Reply