Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > E-mail notification to the site administrator for a new subscriber of any newsletter View modes: 
User avatar
Member
Member
Alex - 1/21/2011 7:43:33 AM
   
E-mail notification to the site administrator for a new subscriber of any newsletter
Hello!

What is the easiest way to send E-mail notification to the site administrator for a new subscriber of any newsletter?
Should I make a new notification module or only change newsletter webpart?

User avatar
Kentico Support
Kentico Support
kentico_radekm - 2/18/2011 4:54:06 AM
   
RE:E-mail notification to the site administrator for a new subscriber of any newsletter
Hello.

I suppose the easiest way is to add a custom code into \CMSWebParts\Newsletters\NewsletterSubscriptionWebPart.ascx.cs, SaveSubscriber() method. You can write/call a code to send e-mail after the subscriber is saved:

// Save subscriber info (line 755 in 5.5R2)
SubscriberProvider.SetSubscriber(sb);


// here you can send e-mail via api.

You can send e-mail message using following example code:

CMS.EmailEngine.EmailMessage msg = new CMS.EmailEngine.EmailMessage();

msg.From = "mymail@domain.com"; // use valid e-mail

msg.Recipients = "mymail@domain.com"; // use valid e-mail

msg.Subject = "Custom BizFrom e-mail";

msg.Body = "The value of the FirstName field: "

+ CMS.GlobalHelper.ValidationHelper.GetString(

this.viewBiz.BasicForm.DataRow["FirstName"], "N/A");

CMS.EmailEngine.EmailSender.SendEmail(msg);


Best Regards,
Radek Macalik

User avatar
Member
Member
James Darlow - 5/4/2011 8:37:04 PM
   
RE:E-mail notification to the site administrator for a new subscriber of any newsletter
Hey I find this will only send the notification email when a user is not signed in and then subscribes.

User avatar
Kentico Support
Kentico Support
kentico_radekm - 5/11/2011 3:12:43 AM
   
RE:E-mail notification to the site administrator for a new subscriber of any newsletter
Hello.

Yes, that´s correct. Your original request was to send e-mail „for a new subscriber.”

SaveSubscriber() method creates a new subscriber and send e-mail, as per your request.

So can you clarify what exactly you want to achieve and under what circumstances?

Thank you.

Best Regards,
Radek Macalik