@Nonnull public static IMicroElement convertToMicroElementStatic (@Nonnull final ISMTPSettings aSMTPSettings, @Nullable final String sNamespaceURI, @Nonnull final String sTagName) { final IMicroElement eSMTPSettings = new MicroElement (sNamespaceURI, sTagName); eSMTPSettings.setAttribute (ATTR_HOST, aSMTPSettings.getHostName ()); eSMTPSettings.setAttribute (ATTR_PORT, aSMTPSettings.getPort ()); eSMTPSettings.setAttribute (ATTR_USER, aSMTPSettings.getUserName ()); eSMTPSettings.setAttribute (ATTR_PASSWORD, aSMTPSettings.getPassword ()); eSMTPSettings.setAttribute (ATTR_CHARSET, aSMTPSettings.getCharsetName ()); eSMTPSettings.setAttribute (ATTR_SSLENABLED, aSMTPSettings.isSSLEnabled ()); eSMTPSettings.setAttribute (ATTR_STARTTLSENABLED, aSMTPSettings.isSTARTTLSEnabled ()); eSMTPSettings.setAttribute (ATTR_CONNECTIONTIMEOUT, aSMTPSettings.getConnectionTimeoutMilliSecs ()); eSMTPSettings.setAttribute (ATTR_TIMEOUT, aSMTPSettings.getTimeoutMilliSecs ()); eSMTPSettings.setAttribute (ATTR_DEBUG_SMTP, aSMTPSettings.isDebugSMTP ()); return eSMTPSettings; }
@Nonnull public String getSMTPServerDisplayText () { String ret = m_aSettings.getHostName (); if (m_aSettings.hasPort ()) ret += ":" + m_aSettings.getPort (); if (m_aSettings.hasUserName ()) { ret += "[" + m_aSettings.getUserName (); if (m_aSettings.hasPassword ()) ret += "/****"; ret += ']'; } return ret; }
/** * Check if the "smtps" properties should be used or not. * * @param aSettings * The base settings. May not be <code>null</code>. * @return <code>true</code> to use "smtps". * @since 1.0.1 */ public static boolean isUseSMTPS (@Nonnull final ISMTPSettings aSettings) { return aSettings.isSSLEnabled () || aSettings.isSTARTTLSEnabled (); }
/** * Constructor which copies settings from another object * * @param aOther * The settings to use. May not be <code>null</code>. */ public SMTPSettings (@Nonnull final ISMTPSettings aOther) { this (aOther.getHostName (), aOther.getPort (), aOther.getUserName (), aOther.getPassword (), aOther.getCharsetObj (), aOther.isSSLEnabled (), aOther.isSTARTTLSEnabled (), aOther.getConnectionTimeoutMilliSecs (), aOther.getTimeoutMilliSecs (), aOther.isDebugSMTP ()); }
aNamedSettings.getID (), aNamedSettings.getName (), aSettings.getHostName (), Integer.valueOf (aSettings.getPort ()), aSettings.getCharsetName (), Boolean.valueOf (aSettings.isSSLEnabled ()), Boolean.valueOf (aSettings.isSTARTTLSEnabled ()), Long.valueOf (aSettings.getConnectionTimeoutMilliSecs ()), Long.valueOf (aSettings.getTimeoutMilliSecs ())); return aNamedSettings;
if (aSettings.isSSLEnabled ()) ret.put (ESMTPTransportProperty.SSL_ENABLE.getPropertyName (bSMTPS), Boolean.TRUE.toString ()); if (aSettings.hasUserName ()) ret.put (ESMTPTransportProperty.AUTH.getPropertyName (bSMTPS), Boolean.TRUE.toString ()); if (aSettings.isSTARTTLSEnabled ()) ret.put (ESMTPTransportProperty.STARTTLS_ENABLE.getPropertyName (bSMTPS), Boolean.TRUE.toString ()); com.sun.mail.util.MailSSLSocketFactory.class.getName ()); ret.put (ESMTPTransportProperty.SSL_SOCKETFACTORY_PORT.getPropertyName (bSMTPS), Integer.toString (aSettings.getPort ())); final long nConnectionTimeoutMilliSecs = aSettings.getConnectionTimeoutMilliSecs (); if (nConnectionTimeoutMilliSecs > 0) ret.put (ESMTPTransportProperty.CONNECTIONTIMEOUT.getPropertyName (bSMTPS), final long nTimeoutMilliSecs = aSettings.getTimeoutMilliSecs (); if (nTimeoutMilliSecs > 0) ret.put (ESMTPTransportProperty.TIMEOUT.getPropertyName (bSMTPS), Long.toString (nTimeoutMilliSecs)); ret.put ("mail.debug", Boolean.toString (aSettings.isDebugSMTP ())); ret.put ("mail.debug.auth", Boolean.toString (aSettings.isDebugSMTP ()));
aRow.addCell (aSettings.getHostName () + (aSettings.hasPort () ? ":" + aSettings.getPort () : "")); aRow.addCell (aSettings.getUserName ());
aTransport.connect (m_aSMTPSettings.getHostName (), m_aSMTPSettings.getPort (), m_aSMTPSettings.getUserName (), m_aSMTPSettings.getPassword ()); MailConverter.fillMimeMessage (aMimeMessage, aEmailData, m_aSMTPSettings.getCharsetObj ());
default boolean hasPort () { return getPort () > 0; }
default boolean hasPassword () { return StringHelper.hasText (getPassword ()); }
default boolean hasUserName () { return StringHelper.hasText (getUserName ()); }
aNamedSettings.getID (), aNamedSettings.getName (), aSettings.getHostName (), Integer.valueOf (aSettings.getPort ()), aSettings.getCharsetName (), Boolean.valueOf (aSettings.isSSLEnabled ()), Boolean.valueOf (aSettings.isSTARTTLSEnabled ()), Long.valueOf (aSettings.getConnectionTimeoutMilliSecs ()), Long.valueOf (aSettings.getTimeoutMilliSecs ())); return EChange.CHANGED; });
aRow.addCell (aSettings.getHostName () + (aSettings.hasPort () ? ":" + aSettings.getPort () : "")); aRow.addCell (aSettings.getUserName ());
sPassword = aSelectedObject.getSMTPSettings ().getPassword ();
sPassword = aSelectedObject.getSMTPSettings ().getPassword ();
.setCtrl (aSettings.getHostName ())); .setCtrl (aSettings.hasPort () ? Integer.toString (aSettings.getPort ()) : EText.PORT_DEFAULT.getDisplayText (aDisplayLocale))); .setCtrl (aSettings.getUserName ())); .setCtrl (aSettings.hasPassword () ? "***" : EText.MSG_NO_PASSWORD_SET.getDisplayText (aDisplayLocale))); .setCtrl (aSettings.getCharsetName ())); .setCtrl (EPhotonCoreText.getYesOrNo (aSettings.isSSLEnabled (), aDisplayLocale))); .setCtrl (EPhotonCoreText.getYesOrNo (aSettings.isSTARTTLSEnabled (), aDisplayLocale))); .setCtrl (Long.toString (aSettings.getConnectionTimeoutMilliSecs ()))); .setCtrl (Long.toString (aSettings.getTimeoutMilliSecs ())));
.setCtrl (aSettings.getHostName ())); .setCtrl (aSettings.hasPort () ? Integer.toString (aSettings.getPort ()) : EText.PORT_DEFAULT.getDisplayText (aDisplayLocale))); .setCtrl (aSettings.getUserName ())); .setCtrl (aSettings.hasPassword () ? "***" : EText.MSG_NO_PASSWORD_SET.getDisplayText (aDisplayLocale))); .setCtrl (aSettings.getCharsetName ())); .setCtrl (EPhotonCoreText.getYesOrNo (aSettings.isSSLEnabled (), aDisplayLocale))); .setCtrl (EPhotonCoreText.getYesOrNo (aSettings.isSTARTTLSEnabled (), aDisplayLocale))); .setCtrl (Long.toString (aSettings.getConnectionTimeoutMilliSecs ()))); .setCtrl (Long.toString (aSettings.getTimeoutMilliSecs ())));
.setCtrl (new HCEdit (new RequestField (FIELD_HOSTNAME, aSettings == null ? null : aSettings.getHostName ())).setPlaceholder (sHostName)) .setErrorList (aFormErrors.getListOfField (FIELD_HOSTNAME))); .setCtrl (new HCAutoNumericInt (new RequestField (FIELD_PORT, aSettings != null && aSettings.hasPort () ? Integer.toString (aSettings.getPort ()) : ""), aDisplayLocale).setMin (CNetworkPort.MINIMUM_PORT_NUMBER) .setCtrl (new HCEdit (new RequestField (FIELD_USERNAME, aSettings == null ? null : aSettings.getUserName ())).setPlaceholder (sUserName)) .setErrorList (aFormErrors.getListOfField (FIELD_USERNAME))); .setCtrl (new HCCharsetSelect (new RequestField (FIELD_CHARSET, aSettings == null ? DEFAULT_CHARSET_NAME : aSettings.getCharsetName ()), true, aDisplayLocale)) .setCtrl (new HCCheckBox (new RequestFieldBoolean (FIELD_SSL, aSettings == null ? EmailGlobalSettings.isUseSSL () : aSettings.isSSLEnabled ()))) .setErrorList (aFormErrors.getListOfField (FIELD_SSL))); .setCtrl (new HCCheckBox (new RequestFieldBoolean (FIELD_STARTTLS, aSettings == null ? EmailGlobalSettings.isUseSTARTTLS ()
.setCtrl (new HCEdit (new RequestField (FIELD_HOSTNAME, aSettings == null ? null : aSettings.getHostName ())).setPlaceholder (sHostName)) .setErrorList (aFormErrors.getListOfField (FIELD_HOSTNAME))); .setCtrl (new HCAutoNumericInt (new RequestField (FIELD_PORT, aSettings != null && aSettings.hasPort () ? Integer.toString (aSettings.getPort ()) : ""), aDisplayLocale).setMin (CNetworkPort.MINIMUM_PORT_NUMBER) .setCtrl (new HCEdit (new RequestField (FIELD_USERNAME, aSettings == null ? null : aSettings.getUserName ())).setPlaceholder (sUserName)) .setErrorList (aFormErrors.getListOfField (FIELD_USERNAME))); .setCtrl (new HCCharsetSelect (new RequestField (FIELD_CHARSET, aSettings == null ? DEFAULT_CHARSET_NAME : aSettings.getCharsetName ()), true, aDisplayLocale)) .setCtrl (new HCCheckBox (new RequestFieldBoolean (FIELD_SSL, aSettings == null ? EmailGlobalSettings.isUseSSL () : aSettings.isSSLEnabled ()))) .setErrorList (aFormErrors.getListOfField (FIELD_SSL))); .setCtrl (new HCCheckBox (new RequestFieldBoolean (FIELD_STARTTLS, aSettings == null ? EmailGlobalSettings.isUseSTARTTLS ()