Hola a todos, nuevamente x aki solicitando ayuda, tengo este codigo ke enkontre por ahi
Código PHP:
import javax.mail.*;
import javax.mail.internet.*;
import java.util.Properties;
class SimpleMail {
public static void main(String[] args) throws Exception{
System.out.println("Sending mail...");
Properties props = new Properties();
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", "bari.ufps.edu.co");
props.setProperty("mail.user", "[email protected]");
props.setProperty("mail.password", "xxxx");
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();
}
}
y cuando lo corro me sale este mensaje de error
Sending mail...
DEBUG: setDebug: JavaMail version 1.3.3ea
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.s
mtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "bari.ufps.edu.co", port 25, isSSL false
Exception in thread "main" javax.mail.MessagingException: Could not connect to S
MTP host: bari.ufps.edu.co, port: 25;
nested exception is:
java.net.SocketException: Software caused connection abort: connect
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTra nsport.java:1227)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SM TPTransport.java:322)
at javax.mail.Service.connect(Service.java:236)
at javax.mail.Service.connect(Service.java:137)
at javax.mail.Service.connect(Service.java:86)
at SimpleMail.main(SimpleMail.java:26)
Press any key to continue...
Ke signifika esto, ke estoy haciendo mal.