0
我試圖在CMS中創建新用戶時向管理員發送電子郵件。但是,當我在VS中調試時創建新用戶時,「umbraco.BusinessLogic.User.New + = User_New」中的第一個斷點;從未被擊中。我正在使用Umbraco的7.3.4版本。Umbraco ApplicationEventHandler不爲用戶解僱
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);
}
}
}
這工作,我不知道UserService。非常感謝你! – NickWojo531