Is it possible to send a newsletter from content section with template other than this set up on Properties tab? I'd like to have than node can be visible on frontent with website template, and sent from content with newsletter-template. I know, that I could use "altTemplate" on frontend, but I don't see this as a good solution.
I had a template to newsletter (send-from-content), that takes all subnodes and build a newsletter from them. But I would like to mark "sent nodes" as "sent" (custom property). Is there an event like "OnNewsletterSent", so I could do it then?
And thank you for answer. I used NS before, and I should have remembered this template naming :)
This is first time I'm using NS in Umbraco 7, and I can't see "Preview" function in "send-out from content", which was in Umbraco 6.
Am I missing something?
I have "only" three buttons: Send out a test e-mail, Send e-mail right now, and Schedule send out for later.
Thats right! We could not include that in the first releases of the package as it requires some really complicated fiddling with the security for the backoffice user.
We're working on it and it will be included but I can't say when.
NewsletterStudio.Services.SendNewsletterService.Sent +=
delegate(object sender, NewsletterSentEventArgs args)
{
// Get id like this
int? nodeId = args.Newsletter.ContentNodeId;
};
using System;
using System.Collections.Generic;
using System.Text;
using Umbraco.Core;
using NewsletterStudio.Infrastucture.Events;
using Umbraco.Core;
using NewsletterStudio.Services;
using Umbraco.Core.Logging;
namespace newsletterstudio_events
{
public class nsEventsAppCode : ApplicationEventHandler
{
public nsEventsAppCode()
{
SendNewsletterService.Sent += SendNewsletterService_Sent;
}
void SendNewsletterService_Sent(object sender, NewsletterStudio.Infrastucture.Events.NewsletterSentEventArgs e)
{
LogHelper.Debug(this.GetType(), "NS TEST AppCode: nodeid:" + e.Newsletter.ContentNodeId.ToString());
}
}
}
I was puzzled why the event was not logged in the Tracelog, till realizing;
instead of
LogHelper.Debug() i should be using LogHelper.Info()
On a related note, if the email is sent from the NS section, how does one get the Draft->mailing list name and id and perhaps rendered body?
I'm also looking at this from the other likely option, i.e. catching the sent e-mails from NS section, and may be construct a page (node) of e-mails sent so they can be presented on the website in the Mailing List Archive section - for end users to see.
Using the event system, if the emails are sent using the NS section (not the content section), how can we get the e-mail sent (title of email, body of email) ?
The reason for this is to create a umbraco page, where the sent e-mails can be listed with their rendering (body), for something like Archive View of E-mails Sent.
If you can share a code snippet on how to go about this that would be very helpfull as I cant locate how to use the events yet.
I'm sorry but I don't have any snippets but the code that Thomas shared is pritty much what you need. Just remove the logging and use the properties from the newsletter-parameter (e.Newsletter) to save a new content node using the Umbraco API.
What I meant to ask is if the email ise sent via the NewsletterStudio section (not content section), then how can we retrieve the e-mail reference (like title (subject), body of the email sent.
Good question! You can't really get that since the full content varies for each subscriber. But you would want the whole rendered content for an email on the web any way? Right?
Thats right, kind of like Email Archive page listing where users can click and see the email online.
If i can get the name of the skin, and the body, is there any way to somehow get the full email to be displayed (like the preview function does, where it uses example as placeholders) ?
You could always use the API to list the newsletters and then use the build in render preview-page to render the letter in preview mode.
Use the this repository to get the newsletters: GlobalFactory.Current.NewsletterRepository
Try following the exsisting preview-links in the backoffice - if you need further assistance with details - please concider either extended support or to hire us to help you out.
Is this how we use the GlobalFactory.Current.NewsletterRepository
var container = new NewsletterStudio.Infrastucture.Data.NewsletterRepository();
var list = container.GetArchived();
foreach (var entry in list){
[email protected]
}
Is that your advised approach?
It would have been great if there was a way to get full MIME of the message. Couldnt find it in the new Events listed.
On a related note;
While using the responsive template, the editor can add table/markup but when the email needs to send out the styles needs to be inlined (like in your responsive sample using INK framework), so what would be your advise on the right place/event do to that?
I thought of reading the Responsive Skin file (IO) and replacing the MessageBody, then sending it to a PreMailer.MoveCssInline(skin-merged-MessageBody)
but then how can we tell NS to use this merged (css-inlined) body to be used in send out?
You are right! The Render Task is the right place to do cssinlining, i was carried away thinking along the lines of getting access to full mime (for spam-scoring, listing etc.).
Back on the topic, if I list all the items in the Archived, how do I sort them by creationdate descending?
var container = new NewsletterStudio.Infrastucture.Data.NewsletterRepository();
var list = container.GetArchived();
foreach (var entry in list){
[email protected]
}
Send-out from Content, templates and events
Hi,
I have to questions:
Is it possible to send a newsletter from content section with template other than this set up on Properties tab? I'd like to have than node can be visible on frontent with website template, and sent from content with newsletter-template. I know, that I could use "altTemplate" on frontend, but I don't see this as a good solution.
I had a template to newsletter (send-from-content), that takes all subnodes and build a newsletter from them. But I would like to mark "sent nodes" as "sent" (custom property). Is there an event like "OnNewsletterSent", so I could do it then?
Umbraco 7.2, NS 2.1.0
Kind regrads
Thomas
Hi!
Thank you for looking at Newsletter Studio!
Yes, you can use another template for the content when you send the campaign. If you front end template is called "TextPage" just create one called "TextPageNewsletter" and Newsletter Studio will use that instead of the one used for the front end. Have a look here: http://support.newsletterstudio.org/customer/portal/articles/1053067-sending-from-the-content-section or at the movie here: http://www.newsletterstudio.org/videos/
Yes, there is a event on the sending-service: NewsletterStudio.Services.SendNewsletterService.Sent
http://support.newsletterstudio.org/customer/portal/articles/1690043-events
The newsletter-object that is passed as a parameter contains a property called ContentNodeId where the content node id i stored.
Cheers!
Hi Markus!
And thank you for answer. I used NS before, and I should have remembered this template naming :)
This is first time I'm using NS in Umbraco 7, and I can't see "Preview" function in "send-out from content", which was in Umbraco 6. Am I missing something? I have "only" three buttons: Send out a test e-mail, Send e-mail right now, and Schedule send out for later.
Kind regards Thomas
Hi!
Thats right! We could not include that in the first releases of the package as it requires some really complicated fiddling with the security for the backoffice user.
We're working on it and it will be included but I can't say when.
// m
Is there a quick sample on how to use the event
a sample code that can place under the App_Code would be very handy to get to learn the new events, and how one can use them.
Hi!
Try this:
Hi Markus,
First, thank you for support! :)
I have tested a little Sent event. Is that right, that it is triggered only when newsletter was sent, not when it was sent as "test"?
Kind regards,
Thomas
That's right! I will not trigger on a test-email.
Cheers!
Hi Thomas
I have tried adding the send event catch snippet in App_Code folder without success.
Do you mind sharing the code? Maybe missing reference or the proper approach...
Something like this works for me:
Kind regards Thomas
Thanks Thomas! =D
Thank you for sharing the code snippet!
I was puzzled why the event was not logged in the Tracelog, till realizing;
instead of LogHelper.Debug() i should be using LogHelper.Info()
On a related note, if the email is sent from the NS section, how does one get the Draft->mailing list name and id and perhaps rendered body?
I'm also looking at this from the other likely option, i.e. catching the sent e-mails from NS section, and may be construct a page (node) of e-mails sent so they can be presented on the website in the Mailing List Archive section - for end users to see.
Hi!
Both your solutions would probably work =D
Have a great weekend!
// m
Hey Markus
Using the event system, if the emails are sent using the NS section (not the content section), how can we get the e-mail sent (title of email, body of email) ?
The reason for this is to create a umbraco page, where the sent e-mails can be listed with their rendering (body), for something like Archive View of E-mails Sent.
If you can share a code snippet on how to go about this that would be very helpfull as I cant locate how to use the events yet.
cheers!
Hi!
I'm sorry but I don't have any snippets but the code that Thomas shared is pritty much what you need. Just remove the logging and use the properties from the newsletter-parameter (e.Newsletter) to save a new content node using the Umbraco API.
Cheers!
/ m
Hi Markus
What I meant to ask is if the email ise sent via the NewsletterStudio section (not content section), then how can we retrieve the e-mail reference (like title (subject), body of the email sent.
The same way as in the example that Thomas posted. Did you try it?
Cheers!
Hi Markus
I have managed to get the body and name of the skin at the sentevent;
e.Newsletter.SkinAlias (like default) e.Newsletter.MessageBody
But how can I get the full email (i.e. skin with content, full html), so I can create a Content Page with full view?
Not sure if we are able to get the MIME, do recall a discussion about it sometime ago.
Hi!
Good question! You can't really get that since the full content varies for each subscriber. But you would want the whole rendered content for an email on the web any way? Right?
// m
Hi Markus
Thats right, kind of like Email Archive page listing where users can click and see the email online.
If i can get the name of the skin, and the body, is there any way to somehow get the full email to be displayed (like the preview function does, where it uses example as placeholders) ?
You could always use the API to list the newsletters and then use the build in render preview-page to render the letter in preview mode.
Use the this repository to get the newsletters: GlobalFactory.Current.NewsletterRepository
Try following the exsisting preview-links in the backoffice - if you need further assistance with details - please concider either extended support or to hire us to help you out.
Cheers!
// m
Hi again Markus
Is this how we use the GlobalFactory.Current.NewsletterRepository
Is that your advised approach? It would have been great if there was a way to get full MIME of the message. Couldnt find it in the new Events listed.
On a related note;
While using the responsive template, the editor can add table/markup but when the email needs to send out the styles needs to be inlined (like in your responsive sample using INK framework), so what would be your advise on the right place/event do to that?
I thought of reading the Responsive Skin file (IO) and replacing the MessageBody, then sending it to a PreMailer.MoveCssInline(skin-merged-MessageBody)
but then how can we tell NS to use this merged (css-inlined) body to be used in send out?
Hi!
Did you look at Render Tasks? You can use them to process the message body during a send out.
http://support.newsletterstudio.org/customer/en/portal/articles/1052872-control-content-with-render-tasks
// m
You are right! The Render Task is the right place to do cssinlining, i was carried away thinking along the lines of getting access to full mime (for spam-scoring, listing etc.).
Back on the topic, if I list all the items in the Archived, how do I sort them by creationdate descending?
Hi!
It's just a list collection - please se the offical C#-documentation on how to sort lists.
https://msdn.microsoft.com/en-us/library/b0zbh7b6(v=vs.110).aspx
// m
is working on a reply...