List of usage examples for javax.mail Transport getURLName
public URLName getURLName()
From source file:nl.nn.adapterframework.senders.MailSender.java
protected void putOnTransport(Message msg) throws SenderException { // connect to the transport Transport transport = null; try {/*from w w w .j a v a 2 s .com*/ CredentialFactory cf = new CredentialFactory(getSmtpAuthAlias(), getSmtpUserid(), getSmtpPassword()); transport = session.getTransport("smtp"); transport.connect(getSmtpHost(), cf.getUsername(), cf.getPassword()); if (log.isDebugEnabled()) { log.debug("MailSender [" + getName() + "] connected transport to URL [" + transport.getURLName() + "]"); } transport.sendMessage(msg, msg.getAllRecipients()); transport.close(); } catch (Exception e) { throw new SenderException("MailSender [" + getName() + "] cannot connect send message to smtpHost [" + getSmtpHost() + "]", e); } finally { if (transport != null) { try { transport.close(); } catch (MessagingException e1) { log.warn("MailSender [" + getName() + "] got exception closing connection", e1); } } } }