Setting email headers from Zimlets using the ONSEND event and Redux

Are you looking to add extra headers to emails in Zimbra? This can now be done in Modern UI using Zimlets. In this article we will introduce you to the newly added SendCustomHeaderMessage component and guide you through the use of Redux by means of an example Zimlet.

What are Zimlets?

Zimlets are add-ons that extend the functionality of Zimbra by allowing developers to integrate their own features seamlessly into the Zimbra web client. They are written in JavaScript (React) and can hook into various events, modify UI elements, and perform actions based on user interactions.

Using ONSEND Event and Redux

In this example, we’ll demonstrate how to send emails with additional headers by leveraging the ONSEND event and Redux.

Redux, a predictable state container for JavaScript apps, allows us to manage application state efficiently. We’ll use it to store a variable that tracks whether the user has clicked a menu item.

Based on this variable, we’ll add extra headers to the email using the SendCustomHeaderMessage component, introduced in Zimbra 10.0.9, and the Zimlet event ONSEND.

How to Implement

Before diving into the code, ensure you have the necessary permissions to set custom headers. Run the following commands as the zimbra user:


zmprov mcf +zimbraCustomMimeHeaderNameAllowed X-Zimbra-App
zmprov mcf +zimbraCustomMimeHeaderNameAllowed X-Zimbra-Type

 

Once you’ve set up the permissions, load the Zimlet using Sideloader. You can find detailed instructions on how to use Sideloader here.

Exploring the Example Zimlet

After loading the Zimlet, you’ll find it accessible via the menu, as shown below:

Take a closer look at the example Zimlet code to understand how Redux and the SendCustomHeaderMessage component work together to enhance email headers.

Further reading

This Zimlet can be found here: https://github.com/Zimbra/zimbra-zimlet-send-header

Setting headers is also possible in the Classic UI, for an example take a look at: https://github.com/Zimbra-Community/rmail

No comments yet.

Leave a Reply

Copyright © 2022 Zimbra, Inc. All rights reserved.

All information contained in this blog is intended for informational purposes only. Synacor, Inc. is not responsible or liable in any manner for the use or misuse of any technical content provided herein. No specific or implied warranty is provided in association with the information or application of the information provided herein, including, but not limited to, use, misuse or distribution of such information by any user. The user assumes any and all risk pertaining to the use or distribution in any form of any subject matter contained in this blog.

Legal Information | Privacy Policy | Do Not Sell My Personal Information | CCPA Disclosures