// method to send account activation mail
        // see description of same method in the code behind
        // the employer sign up page
        public void SendActivationMail(string jsEmail, string username, string jsActivationCode)
        {
            BLLRecruiterWebsiteManager BLLMngr = new BLLRecruiterWebsiteManager();
            List<AdminObj> adminList = BLLMngr.GetListOfAllActiveAdminUsers();
            AdminObj admin = null;
            string adminEmail = "*****@*****.**";
            foreach (AdminObj a in adminList)
            {
                if (a.Email == adminEmail)
                {
                    admin = a;
                }
            }

            string decryptedPwd = Crypto.DecryptStringAES(admin.EmailHash, admin.SecretCode);
            using (MailMessage mm = new MailMessage(admin.Email, jsEmail))
            {
                mm.Subject = "Account Activation";
                string body = "Hello " + username + ",";

                body += "<br /><br />This is your account activation code:";
                body += "<br />" + jsActivationCode;
                body += "<br /><br />Thanks<br />The Recruitment Group";
                mm.Body = body;
                mm.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.Host = "smtp.gmail.com";
                smtp.EnableSsl = true;
                NetworkCredential NetworkCred = new NetworkCredential(admin.Email, decryptedPwd);
                smtp.UseDefaultCredentials = true;
                smtp.Credentials = NetworkCred;
                smtp.Port = 587;
                smtp.Send(mm);
            }
        }
示例#2
0
        // email notification of new job
        public void SendNotificationOfNewJobMail(string jsEmail, string jsUsername, string jobType, string jobTitle, string jobDescription)
        {
            BLLRecruiterWebsiteManager BLLMngr = new BLLRecruiterWebsiteManager();
            List<AdminObj> adminList = BLLMngr.GetListOfAllActiveAdminUsers();
            AdminObj admin = null;
            string adminEmail = "*****@*****.**";
            foreach (AdminObj a in adminList)
            {
                if (a.Email == adminEmail)
                {
                    admin = a;
                }
            }

            string decryptedPwd = Crypto.DecryptStringAES(admin.EmailHash, admin.SecretCode);
            using (MailMessage mm = new MailMessage(admin.Email, jsEmail))
            {
                mm.Subject = "New Job You May be Interested in Available!";
                string body = "Hello " + jsUsername + ",";
                
                body += "<br />Check out this new " + jobType +" job which has just been posted: ";
                body += "<br />Title: " + jobTitle;
                body += "<br />Description: " + jobDescription;
                body += "<br /> See Website for further details!";
                mm.Body = body;
                mm.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.Host = "smtp.gmail.com";
                smtp.EnableSsl = true;
                NetworkCredential NetworkCred = new NetworkCredential(admin.Email, decryptedPwd);
                smtp.UseDefaultCredentials = true;
                smtp.Credentials = NetworkCred;
                smtp.Port = 587;
                smtp.Send(mm);
            }
        }