浏览代码

Added the config options for multiple email servers

rkeil 7 年之前
父节点
当前提交
a646c5f385

+ 13 - 0
server/src/main/java/password/pwm/config/PwmSetting.java

@@ -278,6 +278,19 @@ public enum PwmSetting
     LDAP_ENABLE_WIRE_TRACE(
             "ldap.wireTrace.enable", PwmSettingSyntax.BOOLEAN, PwmSettingCategory.LDAP_GLOBAL ),
 
+    // New multiple email settings
+    EMAIL_PROFILES(
+            "email.profile.list", PwmSettingSyntax.PROFILE, PwmSettingCategory.INTERNAL),
+    EMAIL_SERVER_ADDRESSES(
+            "email.smtp.addresses", PwmSettingSyntax.STRING, PwmSettingCategory.EMAIL_PROFILES),
+    EMAIL_SERVER_PORTs(
+            "email.smtp.ports", PwmSettingSyntax.NUMERIC, PwmSettingCategory.EMAIL_PROFILES),
+    EMAIL_DEFAULT_FROM_ADDRESSES(
+            "email.default.fromAddresses", PwmSettingSyntax.STRING, PwmSettingCategory.EMAIL_PROFILES),
+    EMAIL_USERNAMES(
+            "email.smtp.usernames", PwmSettingSyntax.STRING, PwmSettingCategory.EMAIL_PROFILES),
+    EMAIL_PASSWORDS(
+            "email.smtp.userpasswords", PwmSettingSyntax.PASSWORD, PwmSettingCategory.EMAIL_PROFILES),
 
     // email settings
     EMAIL_SERVER_ADDRESS(

+ 45 - 0
server/src/main/resources/password/pwm/config/PwmSetting.xml

@@ -682,6 +682,46 @@
             <value><![CDATA[User]]></value>
         </default>
     </setting>
+
+    <setting hidden="true" key="email.profile.list" level="1">
+        <regex>^(?!.*all.*)([a-zA-Z][a-zA-Z0-9-]{2,15})$</regex>
+        <properties>
+            <property key="Minimum">1</property>
+        </properties>
+        <default>
+            <value>Email</value>
+        </default>
+    </setting>
+
+    <setting hidden="false" key="email.smtp.addresses" level="1">
+        <regex>^[a-zA-Z0-9.-]*$</regex>
+        <default>
+            <value />
+        </default>
+    </setting>
+    <setting hidden="false" key="email.smtp.ports" level="1">
+        <default>
+            <value>25</value>
+        </default>
+        <properties>
+            <property key="Minimum">1</property>
+            <property key="Maximum">65535</property>
+        </properties>
+    </setting>
+    <setting hidden="false" key="email.default.fromAddresses" level="1">
+        <flag>emailSyntax</flag>
+        <default>
+            <value>noreply@example.org</value>
+        </default>
+    </setting>
+    <setting hidden="false" key="email.smtp.usernames" level="1">
+        <default>
+            <value />
+        </default>
+    </setting>
+    <setting hidden="false" key="email.smtp.userpasswords" level="1">
+    </setting>
+
     <setting hidden="false" key="email.smtp.address" level="1">
         <regex>^[a-zA-Z0-9.-]*$</regex>
         <default>
@@ -3895,6 +3935,11 @@
     <category hidden="false" key="CHALLENGE_POLICY">
         <profile setting="challenge.profile.list"/>
     </category>
+    <category hidden="false" key="EMAIL_PROFILES">
+        <profile setting="email.profile.list"/>
+    </category>
+    <category hidden="false" key="EMAIL_SETTING">
+    </category>
     <category hidden="false" key="EMAIL">
     </category>
     <category hidden="false" key="EMAIL_SETTINGS">

+ 20 - 0
server/src/main/resources/password/pwm/i18n/PwmSetting.properties

@@ -48,6 +48,8 @@ Category_Description_EDIR_SETTINGS=NetIQ eDirectory specific settings.
 Category_Description_EMAIL=<p>Configuration settings for all sent emails.   The settings for the email body configuration are for both plaintext and HTML.  We encourage that for each configured setting and locale for the email body, that you configure both plaintext and HTML. @PwmAppName@ delivers the email in both formats and the email client can choose which to display.</p> <p>Email definitions might use macros.  For more information about macros, see the "View" menu "Show Macro Help".</p>
 Category_Description_EMAIL_SETTINGS=
 Category_Description_EMAIL_TEMPLATES=
+Category_Description_EMAIL_PROFILES=Multiple Email Settings
+#Categoty_Description_EMAIL_SETTING=Email settings
 Category_Description_FORGOTTEN_USERNAME=Allows a user to search for a forgotten user name using a configurable search filter and attributes.
 Category_Description_GENERAL=General settings for the application.  Settings here control the functionality and behavior of the system overall.
 Category_Description_GUEST=Note\: The guest user registration module requires that the logged in user has sufficient permissions to create users and if so configured, to check for duplicate values.
@@ -145,6 +147,8 @@ Category_Label_EDIR_SETTINGS=eDirectory Settings
 Category_Label_EMAIL=Email
 Category_Label_EMAIL_SETTINGS=Email Settings
 Category_Label_EMAIL_TEMPLATES=Email Templates
+Category_Label_EMAIL_PROFILES=Multiple Email Server Settings
+#Category_Label_EMAIL_SETTING=Email Settings
 Category_Label_FORGOTTEN_USERNAME=Forgotten User Name
 Category_Label_GENERAL=Application
 Category_Label_GUEST=Guest Registration
@@ -324,6 +328,14 @@ Setting_Description_email.pwExpirationNotice=Email sent to users to notify the u
 Setting_Description_email.queueMaxAge=Specify the maximum age (in seconds) an email can wait in the send queue.  If an email is in the send queue longer than this time, @PwmAppName@ discards it.  Emails only persist in the send queue if there is an IO or network error to the SMTP server while sending the email.
 Setting_Description_email.sendpassword=Define this template to send an email during forgotten password reset process if you enabled the send password functionality.
 Setting_Description_email.sendUsername=Define this template to send an email for the forgotten user name process.
+
+Setting_Description_email.profile.list=Email profiles for multiple email servers.
+Setting_Description_email.smtp.addresses=Specify an SMTP server address that sends the emails @PwmAppName@ generates.  Removing this setting prevents @PwmAppName@ from sending any emails.  Ensure that the server specified here allows relaying.  For best results, use a local SMTP server.
+Setting_Description_email.smtp.ports=Specify the network port number for the SMTP server.
+Setting_Description_email.smtp.usernames=Specify an SMTP user that logs in to the SMTP server so that it can send the emails @PwmAppName@ generates.  A blank value here sends SMTP messages without authentication.
+Setting_Description_email.smtp.userpasswords=Specify the password for the SMTP user.  A blank value here sends SMTP messages without authentication.
+Setting_Description_email.default.fromAddresses=Specify a default From Address for the email templates.
+
 Setting_Description_email.smtp.address=Specify an SMTP server address that sends the emails @PwmAppName@ generates.  Removing this setting prevents @PwmAppName@ from sending any emails.  Ensure that the server specified here allows relaying.  For best results, use a local SMTP server.
 Setting_Description_email.smtp.advancedSettings=Add Name/Value settings to control the behavior of the mail agent. Available settings are defined as part of the <a href\="https\://javamail.java.net/nonav/docs/api/com/sun/mail/smtp/package-summary.html">JavaMail API</a>. The settings must be in "name\=value" format, where name is the key value of a valid JavaMail API setting.
 Setting_Description_email.smtp.port=Specify the network port number for the SMTP server.
@@ -810,6 +822,14 @@ Setting_Label_email.pwExpirationNotice=Password Expiration Notification Email
 Setting_Label_email.queueMaxAge=Maximum Email Queue Age
 Setting_Label_email.sendpassword=Send Password Email
 Setting_Label_email.sendUsername=Send User Name Email
+
+Setting_Label_email.profile.list=SMTP Email Profiles
+Setting_Label_email.smtp.addresses=SMTP Email Server Address
+Setting_Label_email.smtp.ports=SMTP Email Server Port
+Setting_Label_email.smtp.usernames=SMTP Email Server User Name
+Setting_Label_email.smtp.userpasswords=SMTP Email Server Password
+Setting_Label_email.default.fromAddresses=Default From Address
+
 Setting_Label_email.smtp.address=SMTP Email Server Address
 Setting_Label_email.smtp.advancedSettings=SMTP Email Advanced Settings
 Setting_Label_email.smtp.port=SMTP Email Server Port