no one has answer of my question? please help!!

hi gurus,

i am trying to test sun provided demo programs for testing JAVA Mail API

i am getting these errors please help me out ......

thanks in advance

DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]

DEBUG SMTP: useEhlo true, useAuth false

DEBUG: SMTPTransport trying to connect to host "my.test-inc.com", port 25

DEBUG SMTP RCVD: 220 X1 NT-ESMTP Server my.test-inc.com (IMail 6.05 30687-1)

DEBUG: SMTPTransport connected to host "my.test-inc.com", port: 25

DEBUG SMTP SENT: EHLO pankaj01

DEBUG SMTP RCVD: 250-my.test-inc.com says hello

DEBUG SMTP: use8bit false

DEBUG SMTP SENT: MAIL FROM:<pankaj@test-inc.com>

DEBUG SMTP RCVD: 250-SIZE 0

DEBUG SMTP SENT: RCPT TO:<pankaj@test-inc.com>

DEBUG SMTP RCVD: 250-8BITMIME

Verified Addresses

pankaj@dcr-inc.com

DEBUG SMTP SENT: DATA

DEBUG SMTP RCVD: 250-DSN

DEBUG SMTP SENT: QUIT

javax.mail.SendFailedException: Sending failed;

nested exception is:

javax.mail.MessagingException: 250-DSN

java.lang.Throwable(java.lang.String)

java.lang.Exception(java.lang.String)

javax.mail.MessagingException(java.lang.String, java.lang.Exception)

javax.mail.SendFailedException(java.lang.String, java.lang.Exception, javax.mail.Address [], javax.mail.Address [], javax.mail.Address [])

void javax.mail.Transport.send0(javax.mail.Message, javax.mail.Address [])

void javax.mail.Transport.send(javax.mail.Message)

void adt.com.ocs.ldap.ui.SendFile.main(java.lang.String [])

[1739 byte] By [pnk_jha] at [2007-9-26 1:18:51]
# 1
I need to know your script ie java files.
dritesh at 2007-6-29 0:50:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

i will appriciate if any one tell me that, what am i doing wrong here....

here is the code......

===================

import java.util.Properties;

import javax.mail.*;

import javax.mail.internet.*;

public class MailExample

{

public static void main (String args[]) throws Exception

{

String smtpHost = "my.test-inc.com";

//String smtpHost = "smtp.mail.yahoo.com";

String popHost = "my.test-inc.com";

//String popHost = "pop.mail.yahoo.com";

String from = "pankaj@my.test-inc.com";

String to = "pankaj@my.test-inc.com";

String username = "pankaj";

String password = "pjha";

// Get system properties

Properties props = System.getProperties();

// Setup mail server

props.put("mail.smtp.host", smtpHost);

props.put("mail.smtp.auth", "true");

// Get session

Session session = Session.getInstance(props, new MyAthenticator());

session.setDebug(true);

// Pop Authenticate yourself

Store store = session.getStore("pop3");

store.connect(popHost, username, password);

// Define message

MimeMessage message = new MimeMessage(session);

InternetAddress addrTO=new InternetAddress(to);

InternetAddress addrFROM=new InternetAddress(from);

message.setFrom(addrTO);

System.out.println("from: "+addrFROM.getAddress());

System.out.println("to: "+addrTO.getAddress());

message.addRecipient(Message.RecipientType.TO,addrFROM);

message.setSubject("Hello JavaMail");

message.setText("Welcome to Yahoo's JavaMail");

Transport transport = session.getTransport("smtp");

transport.connect(smtpHost, username, password);

// Send message

transport.send(message);

}

}

class MyAthenticator extends Authenticator

{

public PasswordAuthentication getPasswordAuthentication()

{

return new PasswordAuthentication("pankaj","pjha");

}

}

================

here is the error which is coming.......

DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsy stems, Inc]

POP3: connecting to host "my.test-inc.com", port 110

S: +OK X1 NT-POP3 Server my.test-inc.com (IMail 6.05 53501-1)

C: USER pankaj

S: +OK welcome

C: PASS pjha

S: +OK maildrop locked and ready

from: pankaj@my.test-inc.com

to: pankaj@my.test-inc.com

DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]

DEBUG SMTP: useEhlo true, useAuth true

DEBUG: SMTPTransport trying to connect to host "my.test-inc.com", port 25

DEBUG SMTP RCVD: 220 X1 NT-ESMTP Server my.test-inc.com (IMail 6.05 40049-1)

DEBUG: SMTPTransport connected to host "my.test-inc.com", port: 25

DEBUG SMTP SENT: EHLO pankaj01

DEBUG SMTP RCVD: 250-my.test-inc.com says hello

DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]

DEBUG SMTP: useEhlo true, useAuth true

DEBUG SMTP: useEhlo true, useAuth true

DEBUG: SMTPTransport trying to connect to host "my.test-inc.com", port 25

DEBUG SMTP RCVD: 220 X1 NT-ESMTP Server my.test-inc.com (IMail 6.05 40050-2)

DEBUG: SMTPTransport connected to host "my.test-inc.com", port: 25

DEBUG SMTP SENT: EHLO pankaj01

DEBUG SMTP RCVD: 250-my.test-inc.com says hello

DEBUG SMTP: use8bit false

DEBUG SMTP SENT: MAIL FROM:<pankaj@my.test-inc.com>

DEBUG SMTP RCVD: 250-SIZE 0

DEBUG SMTP SENT: RCPT TO:<pankaj@my.test-inc.com>

DEBUG SMTP RCVD: 250-8BITMIME

Verified Addresses

pankaj@my.test-inc.com

DEBUG SMTP SENT: DATA

DEBUG SMTP RCVD: 250-DSN

DEBUG SMTP SENT: QUIT

javax.mail.SendFailedException: Sending failed;

nested exception is:

javax.mail.MessagingException: 250-DSN

at javax.mail.Transport.send0(Transport.java:219)

at javax.mail.Transport.send(Transport.java:81)

at MailExample.main(MailExample.java:45)

Exception in thread "main" Process Exit...

pnk_jha at 2007-6-29 0:50:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
Looks like you will have to talk to the administrator of the SMTP server.
neville_sequeira at 2007-6-29 0:50:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
but can you explain me what could be the problem here..because i am able to send/receive mail thrugh outlook express and other clients like sun.net.smtp.SmtpClient programs please help me ....its very urgent.....thankspankaj
pnk_jha at 2007-6-29 0:50:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5

Hi Pankaj

Its working fine there are few errors in your code

1. Your host name is not responding.

2. you by mistake reverses the position of sender and reciepients id.

Kindly check them out . I'd tested it with my account and my server and its sending and recieving me mails properly.

dritesh at 2007-6-29 0:50:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 6
hi ritesh,can you send me the code because i changed the code but still it is not sending mails....thankspankaj
pnk_jha at 2007-6-29 0:50:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 7
sorry to bother you ritesh can you send me the output messages when you run your program after session.setDebug(true)thankspankaj
pnk_jha at 2007-6-29 0:50:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 8

this is the output I'm getting through your program

DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsy stems, Inc]

POP3: connecting to host "216.147.121.178", port 110

S: +OK crescotec.com POP3 Server (Version 1.020h) ready.

C: USER ritesh

S: +OK please send PASS command

C: PASS ritesh

S: +OK 0 messages ready for ritesh in /home/cresco12/crescotec-mail/ritesh

from: ritesh@crescotec.com

to: pankaj@my.test-inc.com

DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]

DEBUG SMTP: useEhlo true, useAuth false

DEBUG: SMTPTransport trying to connect to host "216.147.121.178", port 25

DEBUG SMTP RCVD: 220 yourserver.net ESMTP Sendmail 8.10.2/8.10.2; Wed, 25 Jul 2001 16:22:03 -0400

DEBUG: SMTPTransport connected to host "216.147.121.178", port: 25

DEBUG SMTP SENT: EHLO riteshnew

DEBUG SMTP RCVD: 250-yourserver.net Hello 66-2-186-193.customer.algx.net [66.2.186.193], pleased to meet you

250-ENHANCEDSTATUSCODES

250-8BITMIME

250-SIZE

250-DSN

250-ONEX

250-ETRN

250-XUSR

250 HELP

DEBUG SMTP Found extension "ENHANCEDSTATUSCODES", arg ""

DEBUG SMTP Found extension "8BITMIME", arg ""

DEBUG SMTP Found extension "SIZE", arg ""

DEBUG SMTP Found extension "DSN", arg ""

DEBUG SMTP Found extension "ONEX", arg ""

DEBUG SMTP Found extension "ETRN", arg ""

DEBUG SMTP Found extension "XUSR", arg ""

DEBUG SMTP Found extension "HELP", arg ""

DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]

DEBUG SMTP: useEhlo true, useAuth false

DEBUG: SMTPTransport trying to connect to host "216.147.121.178", port 25

DEBUG SMTP RCVD: 220 yourserver.net ESMTP Sendmail 8.10.2/8.10.2; Wed, 25 Jul 2001 16:22:03 -0400

DEBUG: SMTPTransport connected to host "216.147.121.178", port: 25

DEBUG SMTP SENT: EHLO riteshnew

DEBUG SMTP RCVD: 250-yourserver.net Hello 66-2-186-193.customer.algx.net [66.2.186.193], pleased to meet you

250-ENHANCEDSTATUSCODES

250-8BITMIME

250-SIZE

250-DSN

250-ONEX

250-ETRN

250-XUSR

250 HELP

DEBUG SMTP Found extension "ENHANCEDSTATUSCODES", arg ""

DEBUG SMTP Found extension "8BITMIME", arg ""

DEBUG SMTP Found extension "SIZE", arg ""

DEBUG SMTP Found extension "DSN", arg ""

DEBUG SMTP Found extension "ONEX", arg ""

DEBUG SMTP Found extension "ETRN", arg ""

DEBUG SMTP Found extension "XUSR", arg ""

DEBUG SMTP Found extension "HELP", arg ""

DEBUG SMTP: use8bit false

DEBUG SMTP SENT: MAIL FROM:<ritesh@crescotec.com>

DEBUG SMTP RCVD: 250 2.1.0 <ritesh@crescotec.com>... Sender ok

DEBUG SMTP SENT: RCPT TO:<pankaj@my.test-inc.com>

DEBUG SMTP RCVD: 250 2.1.5 <pankaj@my.test-inc.com>... Recipient ok

Verified Addresses

pankaj@my.test-inc.com

DEBUG SMTP SENT: DATA

DEBUG SMTP RCVD: 354 Enter mail, end with "." on a line by itself

DEBUG SMTP SENT:

.

DEBUG SMTP RCVD: 250 2.0.0 f6PKM4A18446 Message accepted for delivery

DEBUG SMTP SENT: QUIT

here is the code that I modified the I had just deleted my user name and password due to some confidentially problem at the organization. I think you can understand it here is the code the location where I had written

xxxxxxx is the user name and ****** is a password.

/**The Code*******************************/

// Copyright (c) 2000 vitalspring

package package1;

/**

* A Class class.

* <P>

* @author developer1

*/

import java.util.Properties;

import javax.mail.*;

import javax.mail.internet.*;

public class Mailer

{

public static void main (String args[]) throws Exception

{

String smtpHost = "216.147.121.178";

//String smtpHost = "smtp.mail.yahoo.com";

String popHost = "216.147.121.178";

// I had replaced my.test-inc.com to 216.147.121.178 the ip address that you can

// get by typing the command ping and the server-name

//String popHost = "pop.mail.yahoo.com";

//String from = "pankaj@my.test-inc.com";

//change this string to my username i.e the account that I have on the above hosts

String from = "ritesh@crescotec.com" ;

String to = "pankaj@my.test-inc.com";

//String username = "pankaj";

String username = "xxxxx" ;

//String password = "pjha";

String password = "*****" ;

// Get system properties

Properties props = System.getProperties();

// Setup mail server

props.put("mail.smtp.host", smtpHost);

//props.put("mail.smtp.auth", "true");

// Get session

// I had just commented out this for testing

//Session session = Session.getInstance(props, new MyAthenticator());

Session session =Session.getInstance (props,null);

session.setDebug(true);

// Pop Authenticate yourself

Store store = session.getStore("pop3");

store.connect(popHost, username, password);

// Define message

MimeMessage message = new MimeMessage(session);

InternetAddress addrTO=new InternetAddress(to);

InternetAddress addrFROM=new InternetAddress(from);

message.setFrom(addrFROM);

System.out.println("from: "+addrFROM.getAddress());

System.out.println("to: "+addrTO.getAddress());

message.addRecipient(Message.RecipientType.TO,addrTO);

message.setSubject("Hello JavaMail");

message.setText("Welcome to Yahoo's JavaMail");

Transport transport = session.getTransport("smtp");

transport.connect(smtpHost, username, password);

// Send message

transport.send(message);

}

}

/*

class MyAthenticator extends Authenticator

{

public PasswordAuthentication getPasswordAuthentication()

{

return new PasswordAuthentication("pankaj","pjha");

}

}

*/

/****************************************/

You must have received a mail from ritesh@crescotec.com at your account that you have specified here. I had also commented the authenticator method...

Sorry your account at this server is not existing since its returned back to me . Anyway ...

have a nice time

dritesh at 2007-6-29 0:50:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...