Hola a todos nuevamente gracias x sus aportes y en cuanto a Willie y Johnw si tenian razon, mi antivirus tenia blokeado el puerto. Cambie el servidor de correos como podran ver en la linea props.put("mail.smtp.host","bari.ufps.edu.co");
Código PHP:
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
public class MailExample {
public static void main (String args[]) throws Exception {
//String host = args[0];
String from = args[0];
String to = args[1];
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", "bari.ufps.edu.co");
// Get session
Session session = Session.getDefaultInstance(props, null);
// Define message
MimeMessage message = new MimeMessage(session);
// Set the from address
message.setFrom(new InternetAddress(from));
// Set the to address
message.addRecipient(Message.RecipientType.TO,
new InternetAddress(to));
// Set the subject
message.setSubject("Hello JavaMail");
// Set the content
message.setText("Welcome to JavaMail");
// Send message
Transport.send(message);
}
}
Y en donde le envio las direcciones komo parametros para el from koloko
[email protected] y en to koloko
[email protected] y ahora me sale este error:
Exception in thread "main" javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
class com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 <cesarceli
[email protected]>... Relaying denied. IP name lookup failed [200.21.251.238]
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTranspo rt.java:1141)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTr ansport.java:536)
at javax.mail.Transport.send0(Transport.java:151)
at javax.mail.Transport.send(Transport.java:80)
at MailExample.main(MailExample.java:37)
Press any key to continue...
Ke kreen ke podria ser ahora, y no solo kon esa sino kon kualkier direccion