If you pay attention to the email templates that are used by your web applications which generated by PHPMaker up to version 9, there is no application name was included in the email templates. The impact is, if your users are using more than one web application that you created by using PHPMaker, then there is the possibility of receiving some emails that use the same Subject. This could be happened since those email templates do not include the application name in the Subject section in order to distinguish between one web application with another. I am sure that this is not good and should be improved in order to distinguish those emails.
This following customization will solve the problem. We will include the application name in all email templates (at least at the Subject section) that used by your web application by customizing all of email templates (request password, activate password, change password, registration, and notify of inserting/editing records or audit trail) and some PHPMaker template files. This customization is very useful, not only for your users, but also for you as a developer if you are creating many web applications. After implementing it, then you don't have to worry anymore how to distinguish emails that received by your users regarding the related web application since the Subject has included the application name.
Please note that some part of the customization below is related to this article. You have to implement it before doing the customization below.
Updated on July 22, 2012: This customization has been implemented in PHPMaker version 9.0.3, it matches to each other, and as a result, it works properly.
Updated on September 5, 2012: This customization has been implemented in PHPMaker version 9.0.4, it matches to each other, and as a result, it works properly.
Updated on November 29, 2012: This customization has been implemented in PHPMaker version 9.1.0, it matches to each other, and as a result, it works properly.
Updated on February 9, 2013: This customization has been implemented in PHPMaker version 9.2.0, it matches to each other, and as a result, it works properly.
Updated on June 17, 2013: This customization below has been handled by using MasinoFixedWidthSite extension. You don’t need to implement the customization below if you use my extensions together with the original PHPMaker Template and Extension files.
[hidepost]
-
Open your C:\Program Files\PHPMaker 9\languages\english.xml file, and find this code:
</global>
before that line, please insert the following code:
<phrase id="SubjectRequestPasswordConfirmation" value="Request Password Confirmation in"/> <phrase id="SubjectSendNewPassword" value="New Password in"/> <phrase id="SubjectChangePassword" value="Password Changed in"/> <phrase id="SubjectRegistrationInformation" value="Registration Information in"/>
Do the same way with your another .xml language. For example, I am also using Indonesian, then I will insert the following code into my C:\Program Files\PHPMaker 9\languages\indonesian.xml file:
<phrase id="SubjectRequestPasswordConfirmation" value="Konfirmasi Permintaan Kata Sandi di"/> <phrase id="SubjectSendNewPassword" value="Kata Sandi Baru di"/> <phrase id="SubjectChangePassword" value="Kata Sandi Berhasil Diganti di"/> <phrase id="SubjectRegistrationInformation" value="Informasi Pendaftaran di"/>
-
Open your \Script\audittrail.php file, find this code and make sure it is located inside the SendEmailOnAdd function::
$Email->ReplaceSender(EW_SENDER_EMAIL); // Replace Sender
before that line, please insert the following code:
// Begin of modification Displaying Application Name in Email Template, by Masino Sinaga, June 5, 2012 $Email->ReplaceSubject($Language->Phrase("RecordInserted").' '.$Language->ProjectPhrase("BodyTitle")); $Email->ReplaceContent('<!--$ApplicationName-->', $Language->ProjectPhrase("BodyTitle")); // End of modification Displaying Application Name in Email Template, by Masino Sinaga, June 5, 2012 -
Still in that \Script\audittrail.php file, find again this code and make sure it is located inside the SendEmailOnEdit function:
$Email->ReplaceSender(EW_SENDER_EMAIL); // Replace Sender
before that line, please insert the following code:
// Begin of modification Displaying Application Name in Email Template, by Masino Sinaga, June 5, 2012 $Email->ReplaceSubject($Language->Phrase("RecordUpdated").' '.$Language->ProjectPhrase("BodyTitle")); $Email->ReplaceContent('<!--$ApplicationName-->', $Language->ProjectPhrase("BodyTitle")); // End of modification Displaying Application Name in Email Template, by Masino Sinaga, June 5, 2012 -
Open your \Script\share-script.php file, and find this code:
$Email->ReplaceSender(EW_SENDER_EMAIL); // Replace Sender
before that line, please insert the following code:
// Begin of modification Displaying Application Name in Email Template, by Masino Sinaga, June 5, 2012 $Email->ReplaceSubject($Language->Phrase("RecordDeleted").' '.$Language->ProjectPhrase("BodyTitle")); $Email->ReplaceContent('<!--$ApplicationName-->', $Language->ProjectPhrase("BodyTitle")); // End of modification Displaying Application Name in Email Template, by Masino Sinaga, June 5, 2012 -
Open your \Script\update-script.php file, and find this code:
$Email->ReplaceSender(EW_SENDER_EMAIL); // Replace Sender
before that line, please insert the following code:
// Begin of modification Displaying Application Name in Email Template, by Masino Sinaga, June 5, 2012 $Email->ReplaceSubject($Language->Phrase("RecordUpdated").' '.$Language->ProjectPhrase("BodyTitle")); $Email->ReplaceContent('<!--$ApplicationName-->', $Language->ProjectPhrase("BodyTitle")); // End of modification Displaying Application Name in Email Template, by Masino Sinaga, June 5, 2012 -
Open your \Script\changepwd.php file, and find this code:
$Email->ReplaceSender(EW_SENDER_EMAIL); // Replace Senderbefore that line, please insert the following code:
// Begin of modification Displaying Application Name in Email Template, by Masino Sinaga, June 5, 2012 $Email->ReplaceSubject($Language->Phrase("SubjectChangePassword").' '.$Language->ProjectPhrase("BodyTitle")); // End of modification Displaying Application Name in Email Template, by Masino Sinaga, June 5, 2012 -
Open your \Script\register.php file, and find this code:
$Email->ReplaceSender(EW_SENDER_EMAIL); // Replace Senderbefore that line, please insert the following code:
// Begin of modification Displaying Application Name in Email Template, by Masino Sinaga, June 5, 2012 $Email->ReplaceSubject($Language->Phrase("SubjectRegistrationInformation").' '.$Language->ProjectPhrase("BodyTitle")); // End of modification Displaying Application Name in Email Template, by Masino Sinaga, June 5, 2012 -
Open your \Script\forgotpwd.php file, and find this code:
$Email->ReplaceSender(EW_SENDER_EMAIL); // Replace Senderbefore that line, please insert the following code:
// Begin of modification Displaying Application Name in Email Template, by Masino Sinaga, June 5, 2012 $Email->ReplaceSubject($Language->Phrase("SubjectRequestPasswordConfirmation").' '.$Language->ProjectPhrase("BodyTitle")); // End of modification Displaying Application Name in Email Template, by Masino Sinaga, June 5, 2012 -
Open your \Script\activatepassword.php file, and find this code:
$Email->ReplaceSender(EW_SENDER_EMAIL); // Replace Sender
before that line, please insert the following code:
// Begin of modification Displaying Application Name in Email Template, by Masino Sinaga, June 5, 2012 $Email->ReplaceSubject($Language->Phrase("SubjectSendNewPassword").' '.$Language->ProjectPhrase("BodyTitle")); // End of modification Displaying Application Name in Email Template, by Masino Sinaga, June 5, 2012 -
Open your \Script\forgotpwd-en.txt file, and find this code:
Subject: Password Request
then replace it with the following code:
Subject: <!--$Subject-->
-
Open your \Script\changepwd-en.php file, and find this code:
Subject: Password Changed
then replace it with the following code:
Subject: <!--$Subject-->
-
Open your \Script\registeren.php file, and find this code:
Subject: Registration Information
then replace it with the following code:
Subject: <!--$Subject-->
-
Open your \Script\requestpwd-en.txt file, and find this code:
Subject: Request Password Confirmation
then replace it with the following code:
Subject: <!--$Subject-->
-
Still in that \Script\notify-en.txt file, find again this code:
Record status changed:
then replace it with the following code:
Record status changed in <!--$ApplicationName-->:
- Finally, re-generate your script files using PHPMaker as always.
[/hidepost]
we need picture to see result
I am sorry I cannot provide you the picture nor screenshot at the moment. However, let me give you an example for this.
Let’s say you have developed three web applications which have their name: “Customer Complaint Handling System”, “Rental Cars System”, and “Library System”. One of your web application users is using those three web applications.
Once upon a time, he forgot the password for “Rental Cars”, and then he visits the Forgot Password page, enters his email and hits the “Send My Password” button, afterwards, system will send an email to him. When he checks his email, then the Subject of it will be: “Request Password Confirmation in Rental Cars System”. The same will be happened if he reset his password for “Library System”, then he will receive an email regarding it, such as “Request Password Confirmation in Library System”, and also “Request Password Confirmation in Customer Complaint Handling System” for the other one.
Now, let’s compare it if you do not implement the customization in the article above. Then, the Subject of three emails that he received will be same for all. It is: “Request Password Confirmation”, and this will make your web application users get confused.
it would be possible somehow the email that arrives when you add , edit , delete … show more information than just the table … .. and id … . for example instead of the id value of a field
You may put your code in Email_Sending server event. Please read Server Events and Client Scripts topic from PHPMaker Help menu.