JAVAMAIL SMTP error 421

B

Blacksheep

Hi all,


I've been looking at this problem for a while, browsing all possible
resources for a possible explanation but no way.
My problem is the following :

I've got a JAVA application listening to messages falling on a
MQSeries queue. The message falling on the queue contains all required
information to compose a mail intended for some recipients. The
application is connected to a mail server and is supposed to send the
mail.
In our development environment everything is fine and works properly.
We are using Exchange server. I made several tests with some 3000
messages falling on the queue and we got 3000 mails in our mail boxes.
The program has been installed at a client site and there we run into
trouble.
After the fifth message has been sent, the program ends with an
exception. It looks like the SMTP server had closed the connection
with no apparent reason.

The log looks like this :

Wed Jun 23 14:59:49 CEST 2004 - spy3 - 5 tasks done.
Wed Jun 23 14:59:50 CEST 2004 - alerter - MailError - Mail server
error in execu
ting a process.
Error when sending a mail through Java Mail API.Can't send command to
SMTP host;
nested exception is:
java.net.SocketException: Software caused connection abort:
socket write error
null
com.misys.alerter.Spy$MailError: Error when sending a mail through
Java Mail API
..Can't send command to SMTP host;
nested exception is:
java.net.SocketException: Software caused connection abort:
socket write
error
at com.misys.alerter.SpyMasterQ.doAction(SpyMasterQ.java:497)
at com.misys.alerter.Spy.run(Spy.java:112)

The line 497 is : try {mailer.sendMail(tmptitle, tmpbody,
recipientTo,recipientDummy, recipientDummy);

The class mailer fills in a mimeMessage and calls

transport.sendMessage(message, message.getAllRecipients() ) ;

which is where I loose control.


The connection to the mail server is made through this method :

public boolean connectSrv( String host, String user, String password)
throws NoSuchProviderException, MessagingException {

Properties props = new Properties();
props.put("mail.smtp.connectiontimeout", "0" );
props.put("mail.smtp.timeout", "0" );
props.put("mail.debug", "true");
session = Session.getDefaultInstance(props, null);
transport = session.getTransport("smtp");
transport.connect(host, user, password);
/* store date time when connection occurs */
dtconnected = new GregorianCalendar();

return transport.isConnected();
}


I added the debug property to get more information. It shows an SMTP
error 421.

Here are some bits of output :

DEBUG SMTP SENT: NOOP
DEBUG SMTP RCVD: 250 2.0.0 OK

DEBUG SMTP SENT: NOOP
DEBUG SMTP RCVD: 250 2.0.0 OK

DEBUG SMTP SENT: NOOP
DEBUG SMTP RCVD: 421 Too many errors on this connection---closing

DEBUG SMTP SENT: NOOP


I have the feeling that something goes wrong on the server side but
have no idea what.
Has any of you already experienced such problem ?

Thanks for your time reading this. Any help or suggestion will be
highly appreciated.

JC
 
T

Tom Regner

Hi,
Blacksheep wrote:
[...]
I added the debug property to get more information. It shows an SMTP
error 421.

Here are some bits of output :

DEBUG SMTP SENT: NOOP
DEBUG SMTP RCVD: 250 2.0.0 OK

DEBUG SMTP SENT: NOOP
DEBUG SMTP RCVD: 250 2.0.0 OK

DEBUG SMTP SENT: NOOP
DEBUG SMTP RCVD: 421 Too many errors on this connection---closing

DEBUG SMTP SENT: NOOP


I have the feeling that something goes wrong on the server side but
have no idea what.

I found the following via google.

http://www.developersdex.com/asp/message.asp?p=2676&ID=<#[email protected]>

And to tell the truth, if I find out how to bring my MTAs to close
connections that send repeated NOOPS, I will configure them
appropriatly ;-).

It's most likely an error on the server side, maybe indeed there's a counter
not reset as mentioned in the thread I linked to.

1. Get in touch with the MTA-admin, if it's someone on-site, else
find out what MTA is running on the other side (see it's response to the
EHLO or HELO command at the start of your debug-transscript), and try to
get in contact with the maintainers other users of the product (via
mailinglists etc.).

hth,
Tom Regner
 
M

Matthew

java is a pain
Hi all,


I've been looking at this problem for a while, browsing all possible
resources for a possible explanation but no way.
My problem is the following :

I've got a JAVA application listening to messages falling on a
MQSeries queue. The message falling on the queue contains all required
information to compose a mail intended for some recipients. The
application is connected to a mail server and is supposed to send the
mail.
In our development environment everything is fine and works properly.
We are using Exchange server. I made several tests with some 3000
messages falling on the queue and we got 3000 mails in our mail boxes.
The program has been installed at a client site and there we run into
trouble.
After the fifth message has been sent, the program ends with an
exception. It looks like the SMTP server had closed the connection
with no apparent reason.

The log looks like this :

Wed Jun 23 14:59:49 CEST 2004 - spy3 - 5 tasks done.
Wed Jun 23 14:59:50 CEST 2004 - alerter - MailError - Mail server
error in execu
ting a process.
Error when sending a mail through Java Mail API.Can't send command to
SMTP host;
nested exception is:
java.net.SocketException: Software caused connection abort:
socket write error
null
com.misys.alerter.Spy$MailError: Error when sending a mail through
Java Mail API
.Can't send command to SMTP host;
nested exception is:
java.net.SocketException: Software caused connection abort:
socket write
error
at com.misys.alerter.SpyMasterQ.doAction(SpyMasterQ.java:497)
at com.misys.alerter.Spy.run(Spy.java:112)

The line 497 is : try {mailer.sendMail(tmptitle, tmpbody,
recipientTo,recipientDummy, recipientDummy);

The class mailer fills in a mimeMessage and calls

transport.sendMessage(message, message.getAllRecipients() ) ;

which is where I loose control.


The connection to the mail server is made through this method :

public boolean connectSrv( String host, String user, String password)
throws NoSuchProviderException, MessagingException {

Properties props = new Properties();
props.put("mail.smtp.connectiontimeout", "0" );
props.put("mail.smtp.timeout", "0" );
props.put("mail.debug", "true");
session = Session.getDefaultInstance(props, null);
transport = session.getTransport("smtp");
transport.connect(host, user, password);
/* store date time when connection occurs */
dtconnected = new GregorianCalendar();

return transport.isConnected();
}


I added the debug property to get more information. It shows an SMTP
error 421.

Here are some bits of output :

DEBUG SMTP SENT: NOOP
DEBUG SMTP RCVD: 250 2.0.0 OK

DEBUG SMTP SENT: NOOP
DEBUG SMTP RCVD: 250 2.0.0 OK

DEBUG SMTP SENT: NOOP
DEBUG SMTP RCVD: 421 Too many errors on this connection---closing

DEBUG SMTP SENT: NOOP


I have the feeling that something goes wrong on the server side but
have no idea what.
Has any of you already experienced such problem ?

Thanks for your time reading this. Any help or suggestion will be
highly appreciated.

JC
 
G

GaryM

(e-mail address removed) (Blacksheep) wrote in
I have the feeling that something goes wrong on the server side but
have no idea what.
Has any of you already experienced such problem ?

Wild guess, but check for anti spam/DDOS measures on your customer's
server. If you are trying to rapid fire a lot of transactions through
the same connection, it could be shutting you out.

Gary
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top