JAVAMAIL SMTP error 421

Discussion in 'Java' started by Blacksheep, Jul 9, 2004.

  1. Blacksheep

    Blacksheep Guest

    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
     
    Blacksheep, Jul 9, 2004
    #1
    1. Advertising

  2. Blacksheep

    Tom Regner Guest

    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=<#>

    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
    --
    Dievision GmbH | Kriegerstrasse 44 | 30161 Hannover
    Telefon: (0511) 288791-0 | Telefax: (0511) 288791-99
    http://www.dievision.de | mailto:
     
    Tom Regner, Jul 9, 2004
    #2
    1. Advertising

  3. Blacksheep

    Matthew Guest

    java is a pain
    (Blacksheep) wrote in message news:<>...
    > 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
     
    Matthew, Jul 31, 2004
    #3
  4. Blacksheep

    GaryM Guest

    (Blacksheep) wrote in
    news::

    >
    > 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
     
    GaryM, Aug 1, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joseph Millar

    Re: Smtp Server error with JavaMail

    Joseph Millar, Jul 16, 2003, in forum: Java
    Replies:
    0
    Views:
    657
    Joseph Millar
    Jul 16, 2003
  2. GaryM
    Replies:
    8
    Views:
    19,905
    Scott Yanoff
    Jul 21, 2003
  3. Sudsy
    Replies:
    0
    Views:
    482
    Sudsy
    Jul 16, 2003
  4. tk
    Replies:
    1
    Views:
    9,337
    Greg R. Broderick
    Aug 31, 2006
  5. ameyas7
    Replies:
    3
    Views:
    1,854
    javabytes
    Aug 31, 2007
Loading...

Share This Page