Código
javax.mail.MessagingException: Could not connect to SMTP host: smtp.live.com, port: 25; nested exception is: at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1706) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:525) at javax.mail.Service.connect(Service.java:291) at javax.mail.Service.connect(Service.java:172) at javax.mail.Service.connect(Service.java:192) at Mail.main(Mail.java:40) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:284) at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:227) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1672)
Sera por el firewall?? o q podría ser???
La linea que me subraya como si estuviera mal es
t.connect(usuario, password);
pero le e metido un usuario y un pass valido del hotmail
aqui el codigo que e utilizado
Código
import java.util.Properties; import javax.mail.Message; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.swing.JOptionPane; public class Mail { try { props.setProperty("mail.smtp.host", "smtp.live.com"); props.setProperty("mail.smtp.starttls.enable", "true"); props.setProperty("mail.smtp.port", "25"); props.setProperty("mail.smtp.user", usuario); props.setProperty("mail.smtp.auth", "false"); Session session = Session.getDefaultInstance(props); session.setDebug(true); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(to)); message.addRecipients(Message.RecipientType.TO, from); message.setSubject(titulo); message.setText(mensaje, "ISO-8859-1","html"); Transport t = session.getTransport("smtp"); t.connect(usuario, password); t.sendMessage(message, message.getAllRecipients()); t.close(); e.printStackTrace(); } } }