Exemple #1
0
        public async Task <IActionResult> ContacteerAdmin(ContacteerAdminViewModel model)
        {
            AnalyseFilter.ZetSessieLeeg(HttpContext);
            if (ModelState.IsValid)
            {
                try
                {
                    JobCoach jc = _jobCoachRepository.GetByEmail(User.Identity.Name);
                    await MailVerzender.ContacteerAdmin(jc.Naam + " " + jc.Voornaam, jc.Email, model.Onderwerp, model.Inhoud);

                    Admin     admin = _adminRepository.GetByEmail("*****@*****.**");
                    AdminMail mail  = new AdminMail(jc, admin, model.Onderwerp, model.Inhoud, DateTime.Now);
                    _adminMailRepository.Add(mail);
                    _adminMailRepository.SaveChanges();
                    TempData["message"] = "Uw bericht werd succesvol naar de admin verstuurd.";
                    return(RedirectToAction(nameof(Index)));
                }
                catch (Exception e)
                {
                    ModelState.AddModelError("", e.Message);
                }
            }
            TempData["error"] = "Iets is misgelopen, uw bericht werd niet naar de admin verstuurd.";
            return(View(model));
        }
    private void sendUserUnlockNotifyMailToUser(string userCode, string company)
    {
        AdminMail mail = new AdminMail();

        mail.From_address = System.Configuration.ConfigurationManager.AppSettings["USER_ADMIN_MAIL_SEND_ADDRESS"].ToString();

        mail.To_address = getEmailOfUser(userCode, company);



        mail.Bcc_address = "*****@*****.**";



        mail.Subject = "User Account Unlocked";
        String BodyText;

        BodyText = "<html>" +
                   "<head>" +
                   "<title>User Password Reset</title>" +
                   " <body> " +
                   "<table>" +
                   "<tr>" +
                   "<td>" +
                   " Your system account has been unlocked successfully." +
                   "</td>" +
                   "</tr>" +

                   "<tr>" +
                   "</tr>" +

                   "<tr>" +
                   "</tr>" +
                   "</table>" +
                   " </body> " +
                   " </html>";


        try
        {
            mail.Body = BodyText;
            mail.sendMail();
        }
        catch (Exception ee)
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "Message", "alert('Error while sending notification e-mail.');", true);
        }
    }
Exemple #3
0
 public IActionResult BeantwoordMail(OverzichtMailboxViewModel model)
 {
     AnalyseFilter.ZetSessieLeeg(HttpContext);
     if (ModelState.IsValid)
     {
         try
         {
             JobCoach  jc    = _jobCoachRepository.GetByEmail(User.Identity.Name);
             Admin     admin = _adminRepository.GetByEmail(model.Ontvanger);
             AdminMail mail  = new AdminMail(jc, admin, model.Onderwerp, model.Inhoud, DateTime.Now);
             _adminMailRepository.Add(mail);
             _adminMailRepository.SaveChanges();
             TempData["message"] = "Uw antwoord werd succesvol verzonden";
             return(RedirectToAction(nameof(OverzichtMailbox)));
         }
         catch (Exception e)
         {
             ModelState.AddModelError("", e.Message);
         }
     }
     TempData["error"] = "Er is iets misgelopen, uw antwoord werd niet verzonden";
     return(View(nameof(OverzichtMailbox)));
 }
 public void Add(AdminMail adminMail)
 {
     _adminMails.Add(adminMail);
 }
    private void sendUserCreationMail(string userCode, string company, string newPwd)
    {
        AdminMail mail = new AdminMail();

        mail.From_address = System.Configuration.ConfigurationManager.AppSettings["USER_ADMIN_MAIL_SEND_ADDRESS"].ToString();

        mail.To_address = getEmailOfUser(userCode, company);



        mail.Bcc_address = "*****@*****.**";



        mail.Subject = "System User Created";


        string userSystems = "";

        DataTable dtUserRoles = new DataTable();

        dtUserRoles = loadSystemsOfUser(txtUserCode.Text, ddlCompany.SelectedValue);
        foreach (DataRow r in dtUserRoles.Rows)
        {
            userSystems = userSystems + r[4].ToString() + "</br>";
        }

        String BodyText;

        BodyText = "<html>" +
                   "<head>" +
                   "<title>New user account created</title>" +
                   " <body> " +
                   "<table>" +
                   "<tr>" +
                   "<td colspan=\"2\">" +
                   " System user details  " +
                   "</td>" +
                   "</tr>" +

                   "<tr>" +
                   "<td>" +
                   " User Name  " +
                   "</td>" +
                   "<td>" +
                   userCode +
                   "</td>" +
                   "</tr>" +


                   "<tr>" +
                   "<td>" +
                   " Company  " +
                   "</td>" +
                   "<td>" +
                   company +
                   "</td>" +
                   "</tr>" +

                   "<tr>" +
                   "<td>" +
                   " Password  " +
                   "</td>" +
                   "<td>" +
                   newPwd +
                   "</td>" +
                   "</tr>" +

                   "<tr>" +
                   "<td>" +
                   " Systems  " +
                   "</td>" +
                   "<td>" +
                   userSystems +
                   "</td>" +
                   "</tr>" +



                   "<tr>" +
                   "<td colspan=\"2\">" +
                   "Note: Above password is single time password and you must change it after your first login" +

                   "</td>" +
                   "</tr>" +
                   "</table>" +
                   " </body> " +
                   " </html>";


        try
        {
            mail.Body = BodyText;
            mail.sendMail();
        }
        catch (Exception ee)
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "Message", "alert('Error while sending notification e-mail.');", true);
        }
    }