Necesito ayuda, el siguiente código me tira una excepción y no sé de que se trata
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
public class SimpleMail {
public static void main(String[] args){
try{
Properties props = new Properties();
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", "correo.espanol.yahoo.com");
props.setProperty("mail.user", "daniel28");
props.setProperty("mail.password", "xxxxxx");
Session mailSession = Session.getDefaultInstance(props, null);
mailSession.setDebug(true);
Transport transport = mailSession.getTransport();
MimeMessage message = new MimeMessage(mailSession);
message.setSubject("HTML mail with images");
message.setFrom(new InternetAddress("
[email protected]"));
message.setContent("<h1>Hello world</h1>", "text/html");
message.addRecipient(Message.RecipientType.TO, new InternetAddress("
[email protected]"));
transport.connect();
transport.sendMessage(message, message.getRecipients(Message.RecipientType.TO));
transport.close();
System.out.println("Mensaje enviado!!!");
}
catch(Exception e){
System.out.println("Error al enviar: " + e.getMessage());
}
}
}
Me tira esta excepción
DEBUG: setDebug: JavaMail version 1.4ea
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "correo.espanol.yahoo.com", port 25, isSSL false
DEBUG SMTP: exception reading response: java.net.SocketException: Connection reset
Error al enviar: Exception reading response
Agradezco mucho su ayuda.