javamail, el dominio se repite con el username
Publicado por Fidel (2 intervenciones) el 30/06/2009 18:14:27
Buenos Días con todos,
Tengo un cliente en javamail que autentica a un usuario al gmail y envia un correo desde esta cuenta. Al momento de autenticar con otra cuenta, por ejemplo la del trabajo, el mensaje llega correctamente pero el nombre de dominio es incorrecto. Por ejemplo sale from: carlos@carlos, cuando debería salir [email protected].
Este caso solo ocurre con el servidor de la empresa mas no en gmail. Creo que se debe configurar o enviar parámetros para poder autenticar.
Slds,
Thanks for your help!
public MailClient(String user, String password ,String host, boolean debug)
{
//try {
//MailSSLSocketFactory sf = new MailSSLSocketFactory();
//sf.setTrustAllHosts(true);
from = user + '@' + host;
authentication = new PasswordAuthentication(user, password);
Properties props = new Properties();
props.put("mail.user", user);
props.put("mail.smtp.host", host);
//props.put("mail.smtp.port", "25");
props.put("mail.debug", debug ? "true" : "false");
props.put("mail.store.protocol", "pop3");
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.ssl.enable", "false");
props.put("mail.smtp.ssl.checkserveridentity", "false");
//props.put("mail.smtp.ssl.socketFactory", sf);
session = Session.getInstance(props, this);
session.setDebug(true);
//} catch (GeneralSecurityException ex) {
// Logger.getLogger(MailClient.class.getName()).log(Level.SEVERE, null, ex);
//}
}
public void sendMessage(String to, String subject, String content) throws MessagingException
{
System.out.println("SENDING message from " + from + " to " + to);
MimeMessage msg = new MimeMessage(session);
msg.addRecipients(Message.RecipientType.TO, to);
msg.setSubject(subject);
System.out.println("Building for sending");
msg.setText(content);
Transport.send(msg);
System.out.println("Send successfully");
}
Tengo un cliente en javamail que autentica a un usuario al gmail y envia un correo desde esta cuenta. Al momento de autenticar con otra cuenta, por ejemplo la del trabajo, el mensaje llega correctamente pero el nombre de dominio es incorrecto. Por ejemplo sale from: carlos@carlos, cuando debería salir [email protected].
Este caso solo ocurre con el servidor de la empresa mas no en gmail. Creo que se debe configurar o enviar parámetros para poder autenticar.
Slds,
Thanks for your help!
public MailClient(String user, String password ,String host, boolean debug)
{
//try {
//MailSSLSocketFactory sf = new MailSSLSocketFactory();
//sf.setTrustAllHosts(true);
from = user + '@' + host;
authentication = new PasswordAuthentication(user, password);
Properties props = new Properties();
props.put("mail.user", user);
props.put("mail.smtp.host", host);
//props.put("mail.smtp.port", "25");
props.put("mail.debug", debug ? "true" : "false");
props.put("mail.store.protocol", "pop3");
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.ssl.enable", "false");
props.put("mail.smtp.ssl.checkserveridentity", "false");
//props.put("mail.smtp.ssl.socketFactory", sf);
session = Session.getInstance(props, this);
session.setDebug(true);
//} catch (GeneralSecurityException ex) {
// Logger.getLogger(MailClient.class.getName()).log(Level.SEVERE, null, ex);
//}
}
public void sendMessage(String to, String subject, String content) throws MessagingException
{
System.out.println("SENDING message from " + from + " to " + to);
MimeMessage msg = new MimeMessage(session);
msg.addRecipients(Message.RecipientType.TO, to);
msg.setSubject(subject);
System.out.println("Building for sending");
msg.setText(content);
Transport.send(msg);
System.out.println("Send successfully");
}
Valora esta pregunta


0