creat alert notification and send email with x++

Hi,

I want to creat alert notification where a record is created in the PurchEditLines Form, and send email to group of users with a parametres ( PurchID,Name…)

EventParameters eventParameters = EventParameters::find();

SysUserInfo sysUserInfo;

UserInfo userinfo;

EventInbox inbox;

UserGroupList UsergroupList;

SysYserInfo = SysUserInfo::find(curUserId());

while select UsergroupList where UsergroupList.groupId ==“01”

{

inbox.initValue();
inbox.ShowPopup = NoYes::Yes;
inbox.Subject = “Préparation de réception marchandise”;
inbox.Message = “?”;
inbox.AlertedFor = “Préparation de réception marchandise”;
inbox.UserId = UsergroupList.userID ;

inbox.TypeId = 1527;
inbox.globalrule = true;

inbox.AlertTableId = tableNum(PurchReceiptsListHeaderTmp);
inbox.AlertFieldId = fieldNum(PurchReceiptsListHeaderTmp, PurchID);
inbox.TypeTrigger = EventTypeTrigger::RecordInsert;
inbox.CompanyId = curext();
inbox.InboxId = EventInbox::nextEventId();
inbox.AlertCreatedDateTime = DateTimeUtil::getSystemDateTime();

inbox.SendEmail = true;

inbox.EmailTemplateId = “001”;

inbox.emailRecipient = "exemple@exemple.com;

inbox.insert();

}

The notification arrives well in a popup f orm with no parameters ( PurchID,Name…) but not send email.

please help me,[:D]

Thanks.