dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14384
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4876: Minor fix
------------------------------------------------------------
revno: 4876
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-10-07 10:43:57 +0200
message:
Minor fix
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java
--
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 2011-10-03 10:33:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java 2011-10-07 08:43:57 +0000
@@ -86,7 +86,7 @@
String hostName = StringUtils.trimToNull( (String) systemSettingManager.getSystemSetting( KEY_EMAIL_HOST_NAME ) );
String username = StringUtils.trimToNull( (String) systemSettingManager.getSystemSetting( KEY_EMAIL_USERNAME ) );
String password = StringUtils.trimToNull( (String) systemSettingManager.getSystemSetting( KEY_EMAIL_PASSWORD ) );
-
+
if ( hostName == null || username == null || password == null )
{
return;
@@ -96,7 +96,9 @@
for ( User user : users )
{
- if ( (Boolean) settings.get( user ) == new Boolean( true ) && user.getEmail() != null && !user.getEmail().isEmpty() )
+ boolean emailNotification = settings.get( user ) != null && (Boolean) settings.get( user ) == true;
+
+ if ( emailNotification && user.getEmail() != null && !user.getEmail().isEmpty() )
{
try
{
@@ -107,10 +109,12 @@
email.setMsg( text );
email.addTo( toAddress );
email.send();
+
+ log.debug( "Sent email to user: " + user + " with email address: " + user.getEmail() );
}
catch ( EmailException ex )
{
- log.warn( "Could not send email to user: " + user + " with email address: " + user.getEmail() );
+ log.warn( "Could not send email to user: " + user + " with email address: " + user.getEmail() + " for reason: " + ex.getMessage() );
}
}
}