Dac Thach Nguyen
Jul 31, 2018
  3036
(5 votes)

Language Manager: Receive email notification when import translation package success

When import a translation package using Language add-on, the project owner will be notified after the package is proccessed. The notification will be display on the bell which is on top of edit view. That required you to login into the system to know. The add-on allowed you to write your own notification provider which send notification in other channels.

In order to write custom provider you need to implement INotificationProvider which has method and property as below:

DisplayName: Name of the provider, example "Email Notification"
SetNotification: Method will be called after the import proccess has been finished.

After implement that interface, your notification provider will be display in config page of the add-on. See the image:Image language.png

Here is simple on I have implement, after config it in the admin page. You should receive email whenever a translation project imported.

public class EmailNotification : INotificationProvider
{
    public string DisplayName => "Email Notification";

    public void SetNotification(string userName, string message)
    {

        var mail = new MailMessage();
        mail.Subject = "Project has been translated successfully";
        mail.Body = message;

        mail.From = new MailAddress("<your email>@gmail.com");
        mail.To.Add(new MailAddress("<your email>@gmail.com"));

        var smtpClient = new SmtpClient();
        smtpClient.Send(mail);
    }
}
Jul 31, 2018

Comments

Please login to comment.
Latest blogs
Copy Optimizely SaaS CMS Settings to ENV Format Via Bookmarklet

Do you work with multiple Optimizely SaaS CMS instances? Use a bookmarklet to automatically copy them to your clipboard, ready to paste into your e...

Daniel Isaacs | Dec 22, 2024 | Syndicated blog

Increase timeout for long running SQL queries using SQL addon

Learn how to increase the timeout for long running SQL queries using the SQL addon.

Tomas Hensrud Gulla | Dec 20, 2024 | Syndicated blog

Overriding the help text for the Name property in Optimizely CMS

I recently received a question about how to override the Help text for the built-in Name property in Optimizely CMS, so I decided to document my...

Tomas Hensrud Gulla | Dec 20, 2024 | Syndicated blog

Resize Images on the Fly with Optimizely DXP's New CDN Feature

With the latest release, you can now resize images on demand using the Content Delivery Network (CDN). This means no more storing multiple versions...

Satata Satez | Dec 19, 2024