I am sending an email using java web application, and it works fine, but if internet connectivity is slow or down, then all other features of the application like a print of that form work fine , but emails are not delivered. So I want to send all remaining emails automatically/schedule when connectivity is good.
You could create an email queue by saving emails ready to send (e.g. into the database). Then a scheduled job will periodically pop the queue, check the connectivity and send the next part if the connectivity is good or just wait until the next scheduler tick hoping it will be good next time.