java - Using apache commons email library getting error must issue a starttls command first. Please help -


  ईमेल ईमेल = नया SimpleEmail (); स्ट्रिंग लेखक = "...... @ gmail.com"; स्ट्रिंग authpwd = "*******"; // बहुत महत्वपूर्ण, ईमेल का उपयोग न करें .setAuthentication () email.setSmtpPort (587); Email.setAuthenticator (नया DefaultAuthenticator (authuser, authpwd)); email.setDebug (सही); // यदि आप ई-मेल .setHostName ("smtp.gmail.com") डीबग करना चाहते हैं तो / Email.getMailSession ()। GetProperties ()। डाल ("mail.smtp.auth", "true"); Email.getMailSession ()। GetProperties ()। डाल ("mail.debug", "true"); Email.getMailSession ()। GetProperties ()। Put ("mail.smtp.port", "587"); Email.getMailSession ()। GetProperties ()। डाल ("mail.smtp.socketFactory.port", "587"); Email.getMailSession ()। GetProperties ()। डाल ("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); Email.getMailSession ()। GetProperties ()। डाल ("mail.smtp.socketFactory.fallback", "false"); Email.getMailSession ()। GetProperties ()। डाल ("mail.smtp.starttls.enable", "true"); Email.setFrom ("........ @ gmail.com", "प्रेषकनाम"); email.setSubject ( "TestMail"); Email.setMsg ("यह एक परीक्षा मेल है?"); Email.addTo ("............. @ gmail.com", "ToName"); email.setTLS (सही); email.send ();  

सभी से छुटकारा email.getMailSession ()। GetProperties () < / कोड> - वे आवश्यक नहीं हैं और सेटअप को प्रदूषित कर सकते हैं।

फिर पोर्ट को सेट करने वाली रेखा को हटा दें। ( ईमेल.setSmtpPort (587); )


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -