← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5026: Included user info in emails

 

------------------------------------------------------------
revno: 5026
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-10-24 18:42:44 +0200
message:
  Included user info in emails
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-07 11:55:51 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java	2011-10-24 16:42:44 +0000
@@ -58,6 +58,7 @@
     private static final int SMTP_PORT = 587;
     private static final String FROM_ADDRESS = "noreply@xxxxxxxxx";
     private static final String SUBJECT_PREFX = "[DHIS2] ";
+    private static final String LB = System.getProperty( "line.separator" );
 
     // -------------------------------------------------------------------------
     // Dependencies
@@ -103,11 +104,17 @@
             {
                 try
                 {
+                    String message = text + LB + LB + 
+                        user.getName() + LB + 
+                        user.getOrganisationUnitsName() + LB +
+                        ( user.getEmail() != null ? ( user.getEmail() + LB ) : StringUtils.EMPTY ) +
+                        ( user.getPhoneNumber() != null ? ( user.getPhoneNumber() + LB ) : StringUtils.EMPTY );
+                    
                     String toAddress = StringUtils.trimToNull( user.getEmail() );
                     
                     Email email = getEmail( hostName, username, password );
                     email.setSubject( SUBJECT_PREFX + subject );
-                    email.setMsg( text );
+                    email.setMsg( message );
                     email.addTo( toAddress );
                     email.send();