Page 1 of 1

(SOLVED) Customize emails

Posted: Mon Apr 10, 2017 1:59 pm
by marcosfpa
Is it possible to customize note notification emails, case cancellation, and password change? I would like to customize them, insert more information, link to the case, etc ...

Att,

Marcos Almeida

Re: Customize emails

Posted: Mon Apr 10, 2017 10:13 pm
by amosbatto
To customize the email sent when canceling, pausing or reassigning a case or sending a case note, go to Admin > Languages, and select your language, then click on Export. Then edit the downloaded processmaker.LANG.po file with PoEdit. Change the following phrases:
- ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION: "A note has been added to the case." (the subject line of the email)
- ID_CASE_CANCEL_LABEL_NOTE: "The case was canceled due to:" (text prefacing the reason given by the user for canceling the case)
- ID_CASE_PAUSE_LABEL_NOTE: "The case was paused due to:" (text prefacing the reason given by the user for pausing the case)

After saving the .po file, return to ProcessMaker and go to Admin > Languages. Click on Import to upload the modified .po file.

Note: If needing to alter more of the body of the note when canceling a case, edit the value of the variable noteReasonTxt, found on line 937 of workflow/engine/templates/cases/open.js:
Code: Select all
                var noteReasonTxt = _('ID_CASE_CANCEL_LABEL_NOTE') + ' ' + Ext.getCmp('noteReason').getValue();
To alter the note when pausing a case, edit the value of the variable noteReasonTxt on line 1384 in the same file:
Code: Select all
                var noteReasonTxt = _('ID_CASE_PAUSE_LABEL_NOTE') + ' ' + Ext.getCmp('noteReason').getValue();
To alter the note when reassigning a case, edit the value of NOTE_REASON on line 1210 in the same file:
Code: Select all
          params : {action : 'reassignCase', USR_UID: rowSelected.data.USR_UID, NOTE_REASON: Ext.getCmp('idTextareaReason').getValue(), NOTIFY_REASSIGN: Ext.getCmp('idCheckboxReason').getValue()},
To alter the subject line and body of case notes, edit lines 169-170 in workflow/engine/classes/model/AppNotes.php:
Code: Select all
            $configNoteNotification['subject'] = G::LoadTranslation( 'ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION' ) . " @#APP_TITLE ";
            $configNoteNotification['body'] = G::LoadTranslation( 'ID_CASE' ) . ": @#APP_TITLE<br />" . G::LoadTranslation( 'ID_AUTHOR' ) . ": $authorName<br /><br />$noteContent";

Then, clear ProcessMaker's cache.

To send a message when a password is changed, you can add code after line 202 in
workflow/engine/methods/users/users_Save.php:
Code: Select all
                $aUserProperty['USR_PASSWORD_HISTORY'] = serialize( $aHistory );
                $oUserProperty->update( $aUserProperty );
                //add code here to call PMFSendMessage()
            }

Re: Customize emails

Posted: Tue Apr 11, 2017 7:38 am
by marcosfpa
OK. But how can I customize the information and layout (logo, etc) of the email sent when the user clicks the "Forgot my password" option?
Screenshot_1.png
Screenshot_1.png (8.25 KiB) Viewed 4624 times
Screenshot_2.png
Screenshot_2.png (7.22 KiB) Viewed 4624 times

Re: Customize emails

Posted: Tue Apr 11, 2017 10:11 am
by zainab
Hello marcosfpa,

The email that is sent during the Forgot Password event is defined in the file retrievePassword.php. Open this file and edit the body structure in order to change the layout and image of the email that is sent. For this go to the following location and open the file:
/opt/processmaker/workflow/engine/methods/login/retrievePassword.php
In this file search for the following piece of code:
Code: Select all
 $sBody = "
  <table style=\"background-color: white; font-family: Arial,Helvetica,sans-serif; color: black; font-size: 11px; text-align: left;\" cellpadding='10' cellspacing='0' width='100%'>
  <tbody><tr><td><img id='logo' src='http://".$_SERVER['SERVER_NAME']."/images/processmaker.logo.jpg' /></td></tr>
  <tr><td style='font-size: 14px;'>$msg</td></tr>
  <tr><td style='vertical-align:middel;'>
  <br /><hr><b>This Business Process is powered by ProcessMaker ver. ".System::getVersion().".<b><br />
  <a href='http://www.processmaker.com' style='color:#c40000;'>www.processmaker.com</a><br /></td>
  </tr></tbody></table>";
The above code defines the body of the email that is sent. Modify this content according to your requirements and save them. This will be reflected when the mail is sent during forgot password.

Hope this helps.

Best Regards,
Zainab Sabunwala

Re: Customize emails

Posted: Tue Apr 11, 2017 2:24 pm
by marcosfpa
Yes, it did. Thank you very much.

Att,
Marcos Almeida