/** * Sends the email in this transport object, * same as calling <code>start()</code>.<p> */ public void send() { start(); } }
/** * Adds a new mail host to the internal list of mail hosts with default port 25.<p> * * @param hostname the name of the mail host * @param order the order in which the host is tried * @param protocol the protocol to use (default "smtp") * @param username the user name to use for authentication * @param password the password to use for authentication */ public void addMailHost(String hostname, String order, String protocol, String username, String password) { addMailHost(hostname, "25", order, protocol, null, username, password); }
/** * Default constructor of a CmsSimpleMail.<p> * * The mail host name and the mail from address are set to the OpenCms * default values of the configuration.<p> * */ public CmsSimpleMail() { // call super constructor super(); CmsMailUtil.configureMail(OpenCms.getSystemInfo().getMailSettings().getDefaultMailHost(), this); }
/** * Default constructor of a CmsSimpleMail.<p> * * The mail host name and the mail from address are set to the OpenCms * default values of the configuration.<p> * */ public CmsSimpleMail() { // call super constructor super(); // set the host to the default mail host CmsMailHost host = OpenCms.getSystemInfo().getMailSettings().getDefaultMailHost(); setHostName(host.getHostname()); this.setSmtpPort(host.getPort()); // check if username and password are provided String userName = host.getUsername(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(userName)) { // authentication needed, set user name and password setAuthentication(userName, host.getPassword()); } try { // set default mail from address setFrom(OpenCms.getSystemInfo().getMailSettings().getMailFromDefault()); } catch (EmailException e) { // default email address is not valid, log error LOG.error(Messages.get().getBundle().key(Messages.LOG_INVALID_SENDER_ADDRESS_0), e); } }
/** * Default constructor of a CmsHtmlMail.<p> * * The mail host name and the mail from address are set to the OpenCms * default values of the configuration.<p> * */ public CmsHtmlMail() { // call super constructor super(); // set the host to the default mail host CmsMailHost host = OpenCms.getSystemInfo().getMailSettings().getDefaultMailHost(); setHostName(host.getHostname()); this.setSmtpPort(host.getPort()); // check if username and password are provided String userName = host.getUsername(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(userName)) { // authentication needed, set user name and password setAuthentication(userName, host.getPassword()); } try { // set default mail from address setFrom(OpenCms.getSystemInfo().getMailSettings().getMailFromDefault()); } catch (EmailException e) { // default email address is not valid, log error LOG.error(Messages.get().getBundle().key(Messages.LOG_INVALID_SENDER_ADDRESS_0), e); } }
/** * Default constructor of a CmsHtmlMail.<p> * * The mail host name and the mail from address are set to the OpenCms * default values of the configuration.<p> * */ public CmsMultiPartMail() { // call super constructor super(); // set the host to the default mail host CmsMailHost host = OpenCms.getSystemInfo().getMailSettings().getDefaultMailHost(); setHostName(host.getHostname()); setSmtpPort(host.getPort()); // check if username and password are provided String userName = host.getUsername(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(userName)) { // authentication needed, set user name and password setAuthentication(userName, host.getPassword()); } try { // set default mail from address setFrom(OpenCms.getSystemInfo().getMailSettings().getMailFromDefault()); } catch (EmailException e) { // default email address is not valid, log error LOG.error(Messages.get().getBundle().key(Messages.LOG_INVALID_SENDER_ADDRESS_0), e); } }
mail.setHostName(host.getHostname()); mail.setSmtpPort(host.getPort()); String userName = host.getUsername(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(userName)) { mail.setAuthentication(userName, host.getPassword()); String security = host.getSecurity() != null ? host.getSecurity().trim() : null; if (SECURITY_SSL.equalsIgnoreCase(security)) { mail.setSslSmtpPort("" + host.getPort()); mail.setSSLOnConnect(true); } else if (SECURITY_STARTTLS.equalsIgnoreCase(security)) { mail.setFrom(OpenCms.getSystemInfo().getMailSettings().getMailFromDefault()); } catch (EmailException e) { LOG.error(Messages.get().getBundle().key(Messages.LOG_INVALID_SENDER_ADDRESS_0), e);
/** * @see java.lang.Object#toString() */ @Override public String toString() { StringBuffer buf = new StringBuffer(64); buf.append(this.getClass().getName()); buf.append(" hostname="); buf.append(getHostname()); buf.append(" port="); buf.append(getPort()); buf.append(" order="); buf.append(m_order); buf.append(" protocol="); buf.append(getProtocol()); if (isAuthenticating()) { buf.append(" user="); buf.append(getUsername()); buf.append(" password="); buf.append(getPassword()); } return buf.toString(); } }
CmsMailHost host = OpenCms.getSystemInfo().getMailSettings().getDefaultMailHost(); Messages.get().container( Messages.ERR_SEND_EMAIL_AUTHENTICATE_2, host.getUsername(), host.getHostname())); rte.initCause(e); throw rte; Messages.get().container(Messages.ERR_SEND_EMAIL_CONFIG_0)); rte.initCause(e); throw rte;
/** * Sets the mail from default sender.<p> * * @param sender the mail from default sender to set */ public void setMailFromDefault(String sender) { m_mailFromDefault = sender; if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.LOG_DEFAULT_SENDER_1, m_mailFromDefault)); } }
CmsMailHost host = OpenCms.getSystemInfo().getMailSettings().getDefaultMailHost(); CmsRuntimeException rte = new CmsRuntimeException(Messages.get().container( Messages.ERR_SEND_EMAIL_AUTHENTICATE_2, host.getUsername(), host.getHostname())); rte.initCause(e); throw rte; CmsRuntimeException rte = new CmsRuntimeException(Messages.get().container( Messages.ERR_SEND_EMAIL_CONFIG_0)); rte.initCause(e);
/** * Default constructor of a CmsHtmlMail.<p> * * The mail host name and the mail from address are set to the OpenCms * default values of the configuration.<p> * */ public CmsMultiPartMail() { // call super constructor super(); CmsMailUtil.configureMail(OpenCms.getSystemInfo().getMailSettings().getDefaultMailHost(), this); }
/** * Sets the mail from default sender.<p> * * @param sender the mail from default sender to set */ public void setMailFromDefault(String sender) { m_mailFromDefault = sender; if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.LOG_DEFAULT_SENDER_1, m_mailFromDefault)); } }
/** * Sends the email in this transport object, * same as calling <code>start()</code>.<p> */ public void send() { start(); } }
/** * Adds a new mail host to the internal list of mail hosts with default port 25.<p> * * @param hostname the name of the mail host * @param order the order in which the host is tried * @param protocol the protocol to use (default "smtp") * @param username the user name to use for authentication * @param password the password to use for authentication */ public void addMailHost(String hostname, String order, String protocol, String username, String password) { addMailHost(hostname, "25", order, protocol, username, password); }
/** * Default constructor of a CmsHtmlMail.<p> * * The mail host name and the mail from address are set to the OpenCms * default values of the configuration.<p> * */ public CmsHtmlMail() { // call super constructor super(); CmsMailUtil.configureMail(OpenCms.getSystemInfo().getMailSettings().getDefaultMailHost(), this); }
/** * Empty constructor, required for configuration.<p> */ public CmsMailSettings() { m_mailFromDefault = MAIL_DEFAULT_SENDER; m_mailHosts = new ArrayList(); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_EMPTY_CONSTRUCTOR_CALLED_1)); } }
/** * Empty constructor, required for configuration.<p> */ public CmsMailSettings() { m_mailFromDefault = MAIL_DEFAULT_SENDER; m_mailHosts = new ArrayList<CmsMailHost>(); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_EMPTY_CONSTRUCTOR_CALLED_1)); } }
/** * @see java.lang.Thread#run() */ @Override public void run() { try { m_email.send(); } catch (EmailException e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.LOG_SEND_MAIL_ERR_0), e); } } }
/** * @see java.lang.Thread#run() */ @Override public void run() { try { m_email.send(); } catch (EmailException e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.LOG_SEND_MAIL_ERR_0), e); } } }