Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Manasa 41 posts 161 karma points
    Jul 13, 2017 @ 03:18
    Manasa
    0

    How to setup the Email Notification in Umbraco

    Hello everyone,

    I would like to get notified when someone create/edit/delete/publish content in my website, i have click on the notifications in the content tree and selected the above options but i didn't get any email. do i need to write any code for that ? how can i set up the notifications? please help me out. Thank you.

  • Manish 373 posts 932 karma points
    Jul 13, 2017 @ 05:57
    Manish
    0

    Hi Chinny

    You can write handler to receive email on activity you need to.

  • Manasa 41 posts 161 karma points
    Jul 13, 2017 @ 06:04
    Manasa
    0

    Thank you Manish , could you please tell me in detail.

  • Manish 373 posts 932 karma points
    Jul 13, 2017 @ 06:20
    Manish
    0
    1. Create a controller in App_code.
    2. Inherit ApplicationEventHandler
    3. Create a custom method lets say "ContentService_Published".
    4. Call this on 'ApplicationStarted'.
  • Manasa 41 posts 161 karma points
    Jul 13, 2017 @ 06:25
    Manasa
    0

    Well, my application is not running through mvc , We are driving through umbraco back-office . I'm this case how can I handle this situation?? I appreciate your response, thank you.

  • Manish 373 posts 932 karma points
    Jul 13, 2017 @ 06:27
    Manish
    0

    You just need to add a new controller in app_code that it.

  • Manish 373 posts 932 karma points
    Jul 13, 2017 @ 06:25
    Manish
    0
    using System.Linq;
    using Umbraco.Core;
    using Umbraco.Core.Models.PublishedContent;
    using System;
    using Umbraco.Core.Logging;
    using Umbraco.Web.Routing;
    namespace  YourSite.App_Code
    {
        public class ConfigurePublishedContentModelFactory : ApplicationEventHandler
        {
            protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            {
    
            }
    
            protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            {
              Umbraco.Core.Services.ContentService.Published += ContentService_Published;
            }
    
    
    
            void ContentService_Published(Umbraco.Core.Publishing.IPublishingStrategy sender, Umbraco.Core.Events.PublishEventArgs<Umbraco.Core.Models.IContent> e)
            {
                try
                {
                   // Your logic to send email on publishing/unpublishing some node
                }
                catch (Exception ex)
                {
                    LogHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "Got this error at", ex);  // log exception here
                }
            }
    
        }
    }
    
  • Sören Deger 733 posts 2844 karma points c-trib
    Jul 13, 2017 @ 06:33
    Sören Deger
    0

    Hi Chinny,

    you should configure your smtp server in web.config. There is a section for this.

    <mailSettings>
      <smtp from="[email protected]">
        <network host="127.0.0.1" userName="" password="" />
      </smtp>
    </mailSettings>
    

    Without this the backend notification service can't work.

    Hope this helps?

    Best, Sören

  • Adrian Wu 53 posts 266 karma points
    Sep 12, 2018 @ 10:28
    Adrian Wu
    0

    Hi Sören, where can i find my host ip if i host my Umbraco in the Azure App service?

    Thanks,

    A

  • Sören Deger 733 posts 2844 karma points c-trib
    Jul 13, 2017 @ 06:34
    Sören Deger
    0

    The notification will be sent to the mailadress of your associated umbraco user.

  • Sören Deger 733 posts 2844 karma points c-trib
    Jul 13, 2017 @ 06:36
    Sören Deger
    0

    And another thing is to set the sender mailadress for the notifications in /config/umbracosettings.config:

     <notifications>
      <!-- the email that should be used as from mail when umbraco sends a notification -->
      <email>[email protected]</email>
    </notifications>
    

    Best, Sören

Please Sign in or register to post replies

Write your reply to:

Draft