java mail keeping Transport object connected
问题 How do i keep the java mail transport object alive or connected. I have written this in my code in a simple class file inside a web application : - @Resource(name = "myMailServer") private Session mailSession; Transport transport ; public boolean sendMail(String recipient, String subject, String text) { boolean exe = false; Properties p = new Properties(); String username = "someone@gmail.com"; String password = "password"; InitialContext c = null; try { c = new InitialContext(); mailSession