Foros del Web » Programación para mayores de 30 ;) » Java »

Error al enviar Correo con JavaMail

Estas en el tema de Error al enviar Correo con JavaMail en el foro de Java en Foros del Web. hola muy buenas, estoy intentando enviar un correo con javamail y el error que me da es el siguiente: Estoy utilizando Exchange 2007 ¡¡¡ Ha ...
  #1 (permalink)  
Antiguo 30/07/2009, 00:44
 
Fecha de Ingreso: agosto-2007
Mensajes: 248
Antigüedad: 16 años, 8 meses
Puntos: 1
De acuerdo Error al enviar Correo con JavaMail

hola muy buenas, estoy intentando enviar un correo con javamail y el error que me da es el siguiente:
Estoy utilizando Exchange 2007 ¡¡¡


Ha ocurrido una excepcion: javax.mail.SendFailedException: Sending failed;
nested exception is: class javax.mail.MessagingException: 501 5.1.7 Invalid address

Al realizar una traza el error me da en la sentencia Transport.send(message);

El codigo fuente es el siguiente: muchas gracias por vuestra colaboracion ¡¡¡
Espero que alguien me pueda echar un cable ya que ando un poco perdido en este tema.

Código PHP:
protected void enviaMiCorreo(String hostString fromString toString filenamethrows Exception
{   

    
System.out.println("Empezamos con EnviaMiCorreo");
    
    
// Get system properties
    
Properties props System.getProperties();    
    
System.out.println("Properties Fin");

    
// Setup mail server
    //props.put("mail.smtp.host", host);
    
props.put("mail.smtp.host"host);   
    
System.out.println("Props Properties Fin");

    
// Get session
    
Session session Session.getInstance(propsnull);
    
System.out.println("Properties Fin Session");

    
// Define message
    
Message message = new MimeMessage(session);
    
message.setFrom(new InternetAddress(from));
    
message.addRecipient(Message.RecipientType.TO
    new 
InternetAddress(to));
    
message.setSubject("Pedido de Consumibles");

    
// Create the message part 
    
BodyPart messageBodyPart = new MimeBodyPart();

    
// Fill the message
    
messageBodyPart.setText("Se adjunta un fichero con el justificante del pedido.");

    
// Create a Multipart
    
Multipart multipart = new MimeMultipart();

    
// Add part one
    
multipart.addBodyPart(messageBodyPart);

    
//
    // Part two is attachment
    //

    // Create second body part
    
messageBodyPart = new MimeBodyPart();

    
// Get the attachment
    
DataSource source = new FileDataSource(filename);

    
System.out.println("DataSource Fin");
    
    
// Set the data handler to the attachment
    
messageBodyPart.setDataHandler(new DataHandler(source));

    
// Set the filename
    
messageBodyPart.setFileName(filename);
    
    
System.out.println("message Body Part Filename");
    
    
// Add part two
    
multipart.addBodyPart(messageBodyPart);
    
    
System.out.println("message Body Body Part");

    
// Put parts in message
    
message.setContent(multipart);
    
    
System.out.println("message set content Multipart");

    
// Send the message
    
Transport.send(message);
    
    
System.out.println("Transportamos el mensaje de correo");    
    
  } 

Última edición por superdober; 30/07/2009 a las 00:50
  #2 (permalink)  
Antiguo 30/07/2009, 02:11
 
Fecha de Ingreso: agosto-2007
Mensajes: 248
Antigüedad: 16 años, 8 meses
Puntos: 1
De acuerdo Respuesta: Error al enviar Correo con JavaMail

Este es el log de errores:

DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "192.168.1.50", port 25

220 ex2007lz.hfp.es Microsoft ESMTP MAIL Service ready at Thu, 30 Jul 2009 10:08:27 +0200
DEBUG SMTP: connected to host "192.168.1.50", port: 25

EHLO curso5
250-ex2007lz.hfp.es Hello [192.168.13.84]
250-SIZE 61685760
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-AUTH
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 XEXCH50
DEBUG SMTP: Found extension "SIZE", arg "61685760"
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "DSN", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "STARTTLS", arg ""
DEBUG SMTP: Found extension "AUTH", arg ""
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "BINARYMIME", arg ""
DEBUG SMTP: Found extension "CHUNKING", arg ""
DEBUG SMTP: Found extension "XEXCH50", arg ""
DEBUG SMTP: Attempt to authenticate
DEBUG SMTP: use8bit false
MAIL FROM:<AR-30/07/2009>
501 5.1.7 Invalid address
QUIT
Ha ocurrido una excepcion: javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.MessagingException: 501 5.1.7 Invalid address
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:23.