dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20304
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9207: Small modification to email sender. If smtphost is 'localhost' then email sender will use port 2...
------------------------------------------------------------
revno: 9207
committer: Bob Jolliffe <bobjolliffe@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-12-07 15:32:11 +0100
message:
Small modification to email sender. If smtphost is 'localhost' then email sender will use port 25 with no authentication to connect to typical postfix or exim style local MTA.
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultSystemSettingManager.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java 2012-11-14 13:11:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java 2012-12-07 14:32:11 +0000
@@ -55,8 +55,8 @@
implements MessageSender
{
private static final Log log = LogFactory.getLog( EmailMessageSender.class );
-
private static final int SMTP_PORT = 587;
+ private static final int LOCAL_SMTP_PORT = 25;
private static final String FROM_ADDRESS = "noreply@xxxxxxxxx";
private static final String FROM_NAME = "DHIS2 Message [No reply]";
private static final String SUBJECT_PREFIX = "[DHIS2] ";
@@ -150,10 +150,18 @@
{
Email email = new SimpleEmail();
email.setHostName( hostName );
- email.setSmtpPort( SMTP_PORT );
- email.setAuthenticator( new DefaultAuthenticator( username, password ) );
- email.setTLS( true );
email.setFrom( FROM_ADDRESS, FROM_NAME );
+
+ if (hostName.equals( "localhost"))
+ {
+ email.setSmtpPort( LOCAL_SMTP_PORT );
+ }
+ else
+ {
+ email.setSmtpPort( SMTP_PORT );
+ email.setAuthenticator( new DefaultAuthenticator( username, password ) );
+ email.setTLS( true );
+ }
return email;
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultSystemSettingManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultSystemSettingManager.java 2012-10-30 15:04:28 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultSystemSettingManager.java 2012-12-07 14:32:11 +0000
@@ -155,6 +155,6 @@
public boolean emailEnabled()
{
- return getEmailHostName() != null && getEmailPassword() != null && getEmailUsername() != null;
+ return getEmailHostName() != null;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js 2012-11-25 22:18:03 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js 2012-12-07 14:32:11 +0000
@@ -442,12 +442,6 @@
"emailSettings" : {
"smtpHostName" : {
"required" : true
- },
- "smtpUsername" : {
- "required" : true
- },
- "smtpPassword" : {
- "required" : true
}
},
"SMSConfig" : {