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?
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.
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:
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
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
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.
is working on a reply...