internal void SendResetEmail(Login_DTO_Create dto, string token) { Resources.BBCode bbc = new Resources.BBCode(); using (eMail email = new eMail()) { string Body = ""; string Subject = ""; string InvitationUrl = ""; Body = Label.Get("email.body.account-reset", dto.LngIsoCode); Subject = Label.Get("email.subject.account-reset", dto.LngIsoCode); InvitationUrl = "[url=" + Configuration_BSO.GetCustomConfig(ConfigType.global, "url.application") + Utility.GetCustomConfig("APP_COOKIELINK_INVITATION_1FA") + '/' + dto.CcnUsername + '/' + token + "]" + "[/url]"; Body = Body + Environment.NewLine + InvitationUrl; Body = bbc.Transform(Body, true); email.Body = Body; email.Subject = Subject; email.To.Add(dto.CcnEmail); email.Send(); } }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { //Translate from bbCode to html Resources.BBCode bbc = new Resources.BBCode(); DTO.Body = bbc.Transform(DTO.Body); List <string> groupCodes = new List <string>(); GroupAccount_ADO gAdo = new GroupAccount_ADO(); foreach (var code in DTO.GroupCodes) { groupCodes.Add(code.GrpCode); } //Get accounts associated with the Group(s) ADO_readerOutput readGroupAccounts = gAdo.ReadMultiple(Ado, groupCodes); Account_ADO accAdo = new Account_ADO(); Account_DTO_Read dtoRead = new Account_DTO_Read(); dtoRead.PrvCode = Resources.Constants.C_SECURITY_PRIVILEGE_POWER_USER; ADO_readerOutput readPowerUsers = accAdo.Read(Ado, dtoRead); //Get the AD data associated with the users, specifically ActiveDirectory_ADO adAdo = new ActiveDirectory_ADO(); adAdo.MergeAdToUsers(ref readGroupAccounts); adAdo.MergeAdToUsers(ref readPowerUsers); eMail email = new eMail(); if (!readGroupAccounts.hasData && !readPowerUsers.hasData) { Response.data = JSONRPC.success; Log.Instance.Debug("No email addresses found"); return(true); } foreach (var user in readGroupAccounts.data) { email.Bcc.Add(user.CcnEmail.ToString()); } foreach (var user in readPowerUsers.data) { email.Bcc.Add(user.CcnEmail.ToString()); } email.Subject = DTO.Subject; email.Body = DTO.Body; sendMail(email, Configuration_BSO.GetCustomConfig("title"), DTO.Subject, DTO.Body); Response.data = JSONRPC.success; return(true); }