Boa noite pessoal! Eu já procurei em todo lugar e já li muitos tutoriais, mas ainda não consigo fazer minha aplicação enviar um bendito e-mail! 
Quando eu tento enviar usando meu e-mail do yahoo, da esse erro [color=red]530 authentication required - “for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html”[/color], segue o código que eu estou usando para esse email…
[code]import java.util.Properties;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class Main{
public Main(){
try{
Properties p = new Properties();
p.put(“mail.smtp.host”, “smtp.mail.yahoo.com.br”);
p.put(“mail.smtp.auth”, “true”);
Session session = Session.getDefaultInstance(p, new Auth());
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(EMAIL1));
InternetAddress[] toList={new InternetAddress(EMAIL2)};
msg.setRecipients(Message.RecipientType.TO, toList);
msg.setSubject("Assunto");
msg.setText("corpo da mensagem");
Transport.send(msg);
}catch(Exception e){
System.out.println(e.getMessage());
}
}
private class Auth extends Authenticator{
protected PasswordAuthentication getPasswordAuthentication(){
return new PasswordAuthentication(LOGIN, SENHA);
}
}
public static void main(String[] args){
new Main();
}
}[/code]
e quando eu tento enviar usando meu e-mail do gmail, da esse erro [color=red]530 5.7.0 Must issue a STARTTLS command first. 30sm1256777agc.29[/color], segue o código que eu estou usando para esse email…
[code]import java.util.Properties;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class Main{
public Main(){
try{
Properties p = new Properties();
p.put(“mail.smtp.host”, “smtp.gmail.com”);
p.put(“mail.smtp.auth”, “true”);
Session session = Session.getDefaultInstance(p, new Auth());
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(EMAIL_GMAIL));
InternetAddress[] toList={new InternetAddress(EMAIL_YAHOO)};
msg.setRecipients(Message.RecipientType.TO, toList);
msg.setSubject("Assunto");
msg.setText("corpo da mensagem");
Transport.send(msg);
}catch(Exception e){
System.out.println(e.getMessage());
}
}
private class Auth extends Authenticator{
protected PasswordAuthentication getPasswordAuthentication(){
return new PasswordAuthentication(LOGIN, SENHA);
}
}
public static void main(String[] args){
new Main();
}
}[/code]
Se alguem puder me ajudar, eu agradeço!
Flw!!!