Ver Mensaje Individual
  #18 (permalink)  
Antiguo 21/03/2007, 12:03
superPojo
 
Fecha de Ingreso: julio-2006
Ubicación: Argentina
Mensajes: 35
Antigüedad: 18 años, 6 meses
Puntos: 0
Re: Problemas con JavaMail (auntetificacion)

Ahora si tengo problemas de autentificacion, maldicion!!! haaaaaaaaaaaaaaa, tengo MyEclipse + JavaMail 1.4, y me tira este error:

14:51:39,406 INFO [STDOUT] com.sun.mail.smtp.SMTPSendFailedException: 530 5.5.1 Authentication Required 24sm3535897wrl

El codigo del programa es este:

Código PHP:
public void sendMail(String tothrows MessagingException{    
        
        
String from "[email protected]"
        
String subject "Titulo del correo";   
        
String message "<b>Mensaje de prueba</b><br><h1>Hola></h1>"
       
String mailhost "smtp.gmail.com"
       
String user "[email protected]";         
                
String password "pass";              
    
         
        
boolean auth true
        
boolean ssl true
        
boolean STARTTLS true;
        
      
        
        
Properties props System.getProperties(); 
         
        if (
mailhost != null){ 
            
props.put("mail.smtp.host"mailhost); 
            
props.put("mail.smtps.host"mailhost); 
        } 
        if (
auth){ 
            
props.put("mail.smtp.auth"auth);  
            
props.put("mail.smtps.auth"auth); 
        } 
     
        
props.put("mail.smtp.port""25"); 
        
props.put("mail.smtps.port""465");
        
props.put("mail.smtps.STARTTLS.enable"STARTTLS);
        
         
        
// Get a Session object 
        
        
javax.mail.Session session javax.mail.Session.getInstance(props); 
        
session.setDebug(true);  
    
        
// construct the message 
        
javax.mail.Message msg = new MimeMessage(session); 
         
        try { 
            
//  Set message details 
            
msg.setFrom(new InternetAddress(from)); 
            
msg.setRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(to)); 
            
msg.setSubject(subject); 
            
msg.setSentDate(new Date()); 
            
msg.setContent(message"text/html"); 
            
//msg.setText(message); 
            
msg.saveChanges();
                     
            
// send the thing off 
            //SMTPTransport t = (SMTPTransport)session.getTransport("smtps"); 
          

            
            
SMTPTransport t = (SMTPTransport)session.getTransport(ssl "smtps" "smtp"); //si ssl=true, smtps si no smtp         
            
            
try { 
                if (
auth){ 
                    
t.connect(mailhostuserpassword);
                }else{ 
                    
t.connect();
                }
                
t.sendMessage(msgmsg.getAllRecipients()); 
            } 
finally 
                
t.close(); 
            } 
           
             
        } catch (
Exception e) { 
            if (
instanceof SendFailedException) { 
                
MessagingException sfe = (MessagingException)e
                
Exception ne
                while ((
ne sfe.getNextException()) != null && 
                    
ne instanceof MessagingException){ 
                        
sfe = (MessagingException)ne
                         } 
             } 
            
e.printStackTrace();
        }  
          
    
    } 
Por favor ayudenmen!!