Я пытаюсь отправить электронное письмо администратору, когда в CMS создается новый пользователь. Но когда я создаю нового пользователя во время отладки в VS, первая точка останова в "umbraco.BusinessLogic.User.New += User_New;" никогда не попадает. Я использую Umbraco версии 7.3.4.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web
using Umbraco.Core;
using umbraco.BusinessLogic;
namespace NewUserEmail
{
/// <summary>
/// Summary description for NewUserNotification
/// </summary>
public class NewUserNotification : ApplicationEventHandler
{
public NewUserNotification()
{
umbraco.BusinessLogic.User.New += User_New;
}
private void User_New(umbraco.BusinessLogic.User sender, EventArgs e)
{
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.To.Add("[email protected]");
message.Subject = "This is the Subject line";
message.From = new System.Net.Mail.MailAddress("[email protected]");
message.Body = "This is the message body";
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("yoursmtphost");
smtp.Send(message);
}
}
}