Certainly. Use javax.mail. Don't reinvent wheels. There are so many things wrong with this code that you would have to rewrite it completely, but, as a working implementation exists, there is no point in helping you fix your broken one.
I cannot imagine why you are interested in this implementation. It will never work. You are treating the server's replies as though they were just drivel to be consumed independently and ignored. It doesn't appear to have entered your head that each reply contains a code telling you whether the request succeeded or not, and if not, why. The reply code in each case must determine whether you proceed, so you must read each reply and act on it before sending the next request. Somewhere in there is an error code that tells you exactly what went wrong with this request, but because of the faulty structure of your code you completely ignored it and just barged ahead.