I have written simple Java code to send an email for error notification.
But what happens is, if new error email notification occurs, we receive email for that error as well old error emails which were sent previously when previous errors were occurred
And mail box is getting flooded.
May be old email messages are getting saved in some buffer and they get triggered once new email is been sent, I am not sure.
I'm also confused about what the problem is. These e-mails which are flooding your inbox: are they the e-mails which you send for error notifications, or are they being sent by something else in response to those e-mails? (First you started to talk about sending e-mails, and then you switched to talking about your inbox without explaining what the connection between those two things was.)