E-posta göndermek için Apache Commons E-posta kitaplığı kullanıyorum, ancak bunları GMail SMTP sunucusu aracılığıyla gönderemiyorum.
Herhangi biri GMail SMTP sunucusu ve diğerleri ile çalışan örnek kod sağlayabilir mi? GMail SMTP sunucusuna e-postaları göndermeJava kullanarak e-posta gönderme Apache Commons e-posta libs
String[] recipients = {"[email protected]"};
SimpleEmail email = new SimpleEmail();
email.setHostName("smtp.gmail.com");
email.setAuthentication("[email protected]", "mypasswd");
email.setDebug(true);
email.setSmtpPort(465);
for (int i = 0; i < recipients.length; i++)
{
email.addTo(recipients[i]);
}
email.setFrom("[email protected]", "Me");
email.setSubject("Test message");
email.setMsg("This is a simple test of commons-email");
email.send();