Copied to clipboard

Flag this post as spam?

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


  • dfarrow 16 posts 27 karma points
    Apr 01, 2010 @ 23:23
    dfarrow
    0

    Sending Emails to Users on Publish

    I would like to create a form where people add their email addresses and then get an email when my "Blog 4 Umbraco" blog posts are published.  I know how to collect the email addresses and send the email, so that's not an issue. 

    I am not sure how to go about sending the emails when the Blog Post is published, however. 

    I have the source code for the "blog4Umbraco" package and saw there is a CreatePost.ascx.cs file with a "createPost_Click" method. In that method there is a block of code like:

    if (publish.Checked) {
    ...
    }

    Should I try adding the code to send the email there or is there another way to go about this? Can anyone point me in the right direction?

    Thanks

     

     

     

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 01, 2010 @ 23:36
    Jan Skovgaard
    0

    Hi

    I think this approach seems sensible and I can't see what should be problematic about it if you already know how to get the e-mail addresses etc.

    So I guess that what I'm saying is..."go for it!".

    However I think that you could also use events to achieve the same goal. You can see how to use events here: http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/event-examples and an overview of all the events here: http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/overview-of-all-events

    Since you are publishing a document and you choose to go with events you should send the e-mail using the "AfterPublish" event I guess.

    /Jan

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Apr 02, 2010 @ 03:53
    Aaron Powell
    1

    Actually you want to use content.AfterUpdateDocumentCache, that event is fired once the XML has been updated, and that's when your page is visible to others.

Please Sign in or register to post replies

Write your reply to:

Draft