Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29755

Is there a way to send mail using gmail smtp without authentication?

$
0
0

For convenience of testing, please let me know how you would like to send emails without authenticating your account and password using gmail smtp.

           HtmlEmail email = new HtmlEmail();
            Properties props = System.getProperties();
            props.put("mail.smtp.host", "smtp.gmail.com");
            props.put("mail.smtp.port", 465);
            props.put("mail.smtp.auth", false);
            email.setSslSmtpPort("465");
            email.setCharset("UTF-8");
            email.addTo("test@gmail.com", "toTest");
            email.setFrom("test@gmail.com", "fromTest");
            email.setSubject("test title");
            email.setHtmlMsg("<html><body>hellow world</body></html>");
            email.setCharset("UTF-8");
            email.send();
            Session session = Session.getDefaultInstance(props, null);
            email.setMailSession(session);

I used the above code but it doesn't work properly. If gmail smtp can not be used without authentication, please let me know other smtp services.


Viewing all articles
Browse latest Browse all 29755

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>