Ver Mensaje Individual
  #2 (permalink)  
Antiguo 20/03/2006, 14:59
Avatar de Ani Alamo
Ani Alamo
 
Fecha de Ingreso: julio-2005
Mensajes: 35
Antigüedad: 18 años, 10 meses
Puntos: 1
Puedes usar los paquetes:
javax.mail.*
javax.mail.internet.*



Un ejemplo aqui lo tienes:

----------------------------
public static void send(String smtpHost, int smtpPort,
String from, String to,
String subject, String content)
throws AddressException, MessagingException {
// Create a mail session
java.util.Properties props = new java.util.Properties();
props.put("mail.smtp.host", smtpHost);
props.put("mail.smtp.auth","true");

auth = new MyAuthenticator("[email protected]", "ani");
Session session = Session.getDefaultInstance(props, auth);

// Construct the message
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
msg.setSubject(subject);
msg.setText(content);

// Send the message
Transport.send(msg);
}


public static void main(String[] args) throws Exception
{
send("mail2.miservidor.com", 25, "[email protected]", "[email protected]",
"re: cena", "mensaje de ani ......");
}

----------------------------
__________________

Ani Alamo Gómez de González


"Sin Dios no soy nada en este mundo, sin El nada puedo ser... ni las hojas de los árboles se mueven, sino es por su gran poder. Bendito seas Señor."