How to use different designs based on the sender domain
This article describes how you can customize the templates for the design of the system emails of NoSpamProxy (including the PDF mails) starting with NoSpamProxy 11.x so that different designs are used based on the sender domain. NoSpamProxy uses the template engine for .NET “Razor” as basis for the dynamic change.
The CSHTML files to be edited are located in the directory %Program Files%\Net at Work Mail Gateway\Intranet Role\Templates. After the change, the files are automatically replicated to all connected gateway roles.
IMPORTANT
You need at least rudimentary HTML knowledge in order to make the adjustments.
Adaptation of the template files
You are welcome to request prefabricated sample files with different designs from NoSpamProxy Support. This file can only be used as of NoSpamProxy 11.0. In this example two different designs are used for the sender domains netatwork.de and nospamproxy.de. You can extend or reduce the number of domains at any time.
After downloading, unpack the ZIP file into a temporary folder. It contains the following files:
- CommonMailTemplate.cshtml
- CommonMailTemplateNaw.cshtml
- CommonMailTemplateNsp.cshtml
- ConvertMailContentToPdfAttachmentActionPdfHeader.cshtml
- ConvertMailContentToPdfAttachmentActionTeaser.cshtml
- EncryptedMailNotificationTemplate.cshtml
Start with the files that begin with “CommonMailTemplate”. Here you determine the appearance of all emails that are required for the PDF Mail. Make sure that you store the standard design in the CommonMailTemplate.cshtml. Customize the style sheets in the respective files according to your needs. The corresponding logos will also be included in these files. In later live operation, the logo files with the correct name must also be available in the Templates folder.
Then adjust the file “ConvertMailContentToPdfAttachmentActionPdfHeader.cshtml”. This file determines the layout of the PDF file as such. In contrast to the CommonMail template files, you only need one file here to define the exceptions. The adjustments take place in the upper part. An example for three different designs is included. What is important is that you specify the design for the different domains. If NoSpamProxy does not find the corresponding sender domain during live operation, it uses the default design, which you can define with the template editor in the admin GUI.
When all files are adjusted, copy all CSHTML files into the Templates folder of your program version. Make a backup of all contained files beforehand!
Please note that the files will be overwritten when patching or upgrading. After a version upgrade, please do not copy the older, modified files over the newer ones, but modify them again. Otherwise there is a risk that new, necessary information will be missing in the template files.
Overview of available template files
The following list provides an overview of the function of the individual files:
ApplySymmetricEncryptionPasswordNotice.cshtml
If a user sends an email as PDF Mail, he will receive a notification of the password used, or information that the password was sent to the recipient by SMS or that the creation of the PDF Mail failed. The text of the respective notification is in this file. The appearance regarding colors and logo is defined via the CommonMailTemplate.
AttachmentManager.cshtml
If a file is removed from an email using the content filter rules, the recipient receives information about it. The attachment can either be removed and deleted, it can be uploaded to the Web Portal, and it can be uploaded to the Web Portal and assigned an admin share. A separate text is available for each of the three actions, which can be edited in this file. The appearance regarding colors and logo is defined via the CommonMailTemplate.
AttachmentManagerNotificationForBlockedAttachmentsModel.cshtml
If emails with certain file attachments are rejected via the content filter rules, the sender receives information about the rejection. The content of this message can be defined in this file. The appearance regarding colors and logo is defined via the CommonMailTemplate.
AttachmentQuarantine.cshtml
If a file is moved to the Web Portal using the content filter rules and assigned an admin share, the administrator receives an info mail about it. The content of this email is defined in this file. The appearance with regard to colors and logo is determined via the CommonMail template.
AttachmentQuarantineApproval.cshtml
If a file is moved to the Web Portal using the content filter rules, assigned an admin release, and then released by the administrator, the actual recipient of the file receives information about the release. The content of this email is defined in this file. The appearance with regard to colors and logo is determined by the CommonMail template.
CommonMailTemplate.cshtml
This file defines the general appearance of notifications. Here, for example, the colors and the logos to be used are stored as HTML tags. All other files except the “ConvertMailContentToPdfAttachmentActionPdfHeader.cshtml” contain only the text modules.
ConvertMailContentToPdfAttachmentActionPdfHeader.cshtml
The appearance of the PDF file is defined in this file. Colors and logos must be defined here again.
ConvertMailContentToPdfAttachmentActionTeaser.cshtml
This file contains the text for the carrier email of the PDF file. The recipient of a PDF Mail is informed that the actual content of the email is in the attached PDF document. The appearance is defined via the CommonMailTemplate.
ConvertOfficeDocumentToPdfPreface.cshtml
With the “ConvertOfficeDocumentToPDF” action, it is possible to convert Office documents to PDF to provide the recipient with a preview without active content. Information is placed in front of the generated PDF document. The content of this information is defined with this file.
DeliveryNotificationReport.cshtml
This is the content of the send report if a user has requested it in Outlook. The appearance is defined via the CommonMailTemplate.
DeMailConnectorIssueEscalationMail.cshtml
If NoSpamProxy cannot retrieve or send De-Mail repeatedly, an administrator will be notified. The content of this message can be defined here.
EncryptedMailNotificationTemplate.cshtml
If a user marks an email as “Automatically encrypt” and enQsig does not have a cryptographic key, the recipient will be informed. This info mail states which options he has. The content of this email is recorded in this template. The appearance is defined via the CommonMailTemplate.
EncryptionDelayedNotificationForSender.cshtml
If a user marks an email as “Automatically encrypt” and enQsig does not have a cryptographic key, the sender is informed about the delay. The content of the delay message is defined here. The appearance is defined via the CommonMailTemplate.
EncryptionFailureNotificationForSender.cshtml
If a user marks an email as “Automatically encrypt” and an encryption error occurs, the sender is informed. The content of this message can be found here. The appearance is defined via the CommonMailTemplate.
EncryptionSucceededNotificationForSender.cshtml
If a user marks an email as “Automatically encrypt”, he will receive a notification as soon as the email has been encrypted. The appearance is defined via the CommonMailTemplate.
LargeFileDownloadNotification.cshtml
If the recipient of a file that was previously moved to the Web Portal downloads it, the sender is notified. The content of this information is determined by this file.
MailOnHoldExpired.cshtml
If a user marks an email as “Automatically encrypt” and enQsig has no cryptographic key and the recipient of the email does not deposit a cryptographic key within 5 days, the email will be discarded and the sender informed. The content of this message can be found here. The appearance is defined via the CommonMailTemplate.
MailValidationError.cshtml
If a De-Mail cannot be sent via the De-Mail connector, the sender is notified. The content of this message can be found here. The appearance is defined via the CommonMailTemplate.
PolicyFailureNonDeliveryMessage.cshtml
The sender will be notified if an email violates the policy in the rules. The content of this message can be found here. The appearance is defined via the CommonMailTemplate.
QualifiedSignatureIssueEscalationMail.cshtml
If the verification or creation of a qualified signature fails, a notification is sent to a specified address. The content of this message can be found here. The appearance is defined via the CommonMailTemplate.
SampleAutoReply.cshtml
With the action “AutoReply” it is possible to answer e-mails with an automatically generated email. The content of this reply is defined here.
SymmetricPasswordUpdateNotification.cshtml
If an external recipient has stored a password for the PDF mail on the WebPortal, he will be notified of the change. The content of this message can be found here. The appearance is defined via the CommonMailTemplate.
WordFilterMatchNotification.cshtml
The word filter provides the ability to notify any email address when certain words are found in emails. The content of this notification can be defined here.