Ver Mensaje Individual
  #5 (permalink)  
Antiguo 01/12/2011, 09:21
Avatar de javih
javih
 
Fecha de Ingreso: agosto-2011
Mensajes: 201
Antigüedad: 12 años, 8 meses
Puntos: 12
Respuesta: envio mensajes con protocolo SMTP java

Yo lo hago con este código e importando javax.mail.*

Properties propsSSL = _setPropertiesSSL();

Session session = Session.getInstance(propsSSL, this);

MimeMessage msg = new MimeMessage(session);

msg.setFrom(new InternetAddress(_from));

InternetAddress addressTo = new InternetAddress(_to);
addressTo = new InternetAddress(_to);
msg.setRecipient(MimeMessage.RecipientType.TO, addressTo);

msg.setSubject(_subject);
msg.setSentDate(new Date());

BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(_body);
_multipart.addBodyPart(messageBodyPart);

msg.setContent(_multipart);

Transport.send(msg);


Sobre el error 501 >> Aquí tienes como funciona el protocolo >> http://tools.ietf.org/html/rfc5321

501 Syntax error in parameters or arguments

ta cantao, tienes un error en la sintaxis.