Bom dia Luciano,
uma vez tive que fazer isso para um cliente e usei da seguinte maneira.
private Properties getProperties() {Properties props = new Properties();if (auth) {props.put("mail.smtp.auth", true);}if (debuggable) {props.put("mail.debug", "true");}props.put("mail.smtp.host", host);props.put("mail.smtp.port", port);props.put("mail.smtp.quitwait", "false");props.put("mail.transport.protocol", "smtp");if (!ssl) {props.put("mail.smtp.starttls.enable", "true");props.put("mail.smtp.ssl.trust", host);}else {props.put("mail.smtp.socketFactory.port", port);props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");props.put("mail.smtp.socketFactory.fallback", "false");}return props;}
Não sei se ajuda.
Mas no mu caso consegui assim mas foi com servidor do Gmail com outros não cheguei a testar.
Em 24 de agosto de 2015 13:49, Luciano Pimenta <lucianoalmeidapimenta@gmail.com> escreveu:
Boa tarde,--Preciso enviar e-mail, sem o client do Gmail, por exemplo, somente via código.Achei esse exemplo: http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-built-in-a/2033124#2033124No meu caso, não usarei Gmail, será UOL.Ao executar o exemplo, recebo a mensagem de javax.mail.AuthenticationFailedException.Os dados de configuração (user e senha) estão corretos.Pesquisei sobre o assunto e só acho em relação a Properties, que estão assim configuradas:Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.transport.protocol", "smtps");
props.put("mail.smtp.host", "smtps.uol.com.br");
props.put("mail.smtp.port", "587");
props.put("mail.smtp.ssl.trust", "smtps.uol.com.br");O servidor requer autenticação.Se alguém tiver alguma ajuda, agradeço.AttLuciano Pimenta
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.






0 comentários:
Postar um comentário