示例#1
0
 public ActionResult Edit(MailUsers model)
 {
     if (ModelState.IsValid)
     {
         if (RouteData.Values["id"] != null)
         {
             int  nid      = 0;
             bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
             if (isnumber)
             {
                 model.MailUserId       = nid;
                 ViewBag.ProcessMessage = MailManager.EditMailUser(model);
                 return(View(model));
             }
             else
             {
                 ViewBag.ProcessMessage = false;
                 return(View(model));
             }
         }
         else
         {
             return(View());
         }
     }
     else
     {
         return(View());
     }
 }
示例#2
0
        public ActionResult MailSetting(MailSetting model, string txtpassword)
        {
            var record = MailManager.GetMailSettings();

            if (record == null)
            {
                ViewBag.nullsetting    = true;
                model.Password         = txtpassword;
                ViewBag.ProcessMessage = MailManager.AddSetting(model);
                return(View(model));
            }
            else
            {
                if (!string.IsNullOrEmpty(txtpassword))
                {
                    model.Password = txtpassword;
                }

                ViewBag.nullsetting    = false;
                model.MailSettingId    = record.MailSettingId;
                ViewBag.ProcessMessage = MailManager.EditSetting(model);
            }
            ////            record.TypeId = Convert.ToInt32(EnumInstituionalTypes.Misyon);
            //ViewBag.ProcessMessage = MailManager.AddMailUsers(model);
            //ModelState.Clear();
            return(View());
        }
示例#3
0
        public ActionResult Add(MailUsers model)
        {
//            record.TypeId = Convert.ToInt32(EnumInstituionalTypes.Misyon);
            ViewBag.ProcessMessage = MailManager.AddMailUsers(model);
            ModelState.Clear();
            return(View());
        }
示例#4
0
        public static bool BuscarCamposCorreoSMS(int sCod, string NombreCliente, string CorreoDestino)
        {
            bool flag = false;

            try
            {
                foreach (DatosCorreo datosCorreo in HelperGlobal.BDI_DatosCorreoGetByDC_CodTrans(sCod.ToString()))
                {
                    string dCContenido = datosCorreo.DC_Contenido;
                    dCContenido = dCContenido.Replace("{NombreCliente}", NombreCliente.Trim());
                    MailManager.SendMail(CorreoDestino, datosCorreo.DC_Subject, dCContenido, true);
                    flag = true;
                }
            }
            catch (IBException bException)
            {
            }
            catch (WebException webException)
            {
                throw new IBException("1000", "SQLIB");
            }
            catch (Exception exception)
            {
                string.Concat("error al mandar el correo. ", exception.Message);
            }
            return(flag);
        }
        protected void Run(BaseDataMap map, LevelLogger logger, OutputHandlerBase exporter)
        {
            Context.Job.Status.State = JobState.Running;
            logger.AddKey(Utility.Constants.DataSyncItemId, map.ImportItem.ID.ToString());
            logger.AddData(Utility.Constants.DataSyncItem, map.ImportItem);
            logger.AddData(Logger.Log.Constants.Identifier, map.ImportItem.Name);
            var startedAt = DateTime.Now;

            logger = map.Process();
            var finishededAt = DateTime.Now;

            logger.AddData(Logger.Log.Constants.StartTime, startedAt);
            logger.AddData(Logger.Log.Constants.EndTime, finishededAt);
            try
            {
                MailManager.SendLogReport(ref logger, exporter);
            }
            catch (Exception exception)
            {
                Diagnostics.Log.Error(exporter.GetIdentifier() + " failed in sending out the mail. Please see the exception message for more details. Exception:" + exception.Message + ". Status:\r\n" +
                                      exporter.Export(), typeof(DataSyncWizard));
            }
            if (logger.HasErrors())
            {
                Context.Job.Status.Failed = true;
            }
            else
            {
                Context.Job.Status.State = JobState.Finished;
            }
        }
示例#6
0
        public static bool EnviarCorreoClaveTemporal(string NombreTitular, string correodestino, string claveesp)
        {
            bool flag = false;

            try
            {
                foreach (DatosCorreo datosCorreo in HelperGlobal.BDI_DatosCorreoGetByDC_CodTrans("999"))
                {
                    string dCContenido = datosCorreo.DC_Contenido;
                    dCContenido = dCContenido.Replace("<NombreTitular>", NombreTitular.ToString().Trim().ToUpper());
                    DateTime now = DateTime.Now;
                    dCContenido = dCContenido.Replace("<FechaHora>", now.ToString("dd/MM/yyyy hh:mm:ss"));
                    dCContenido = dCContenido.Replace("<claveesp>", claveesp);
                    MailManager.SendMail(correodestino, datosCorreo.DC_Subject, dCContenido, true);
                    flag = true;
                }
            }
            catch (IBException bException)
            {
            }
            catch (WebException webException)
            {
                throw new IBException("1000", "SQLIB");
            }
            catch (Exception exception)
            {
                string.Concat("error al mandar el correo. ", exception.Message);
            }
            return(flag);
        }
示例#7
0
        public void ProcessQueueMessage([QueueTrigger("%azure-queue-accessdata%")] string message, TextWriter log)
        {
            try
            {
                UserWalletManager userWalletManager = new UserWalletManager();
                MailManager       mailManager       = new MailManager();
                Notification      notification      = userWalletManager.GetNotification(message);

                var user   = aspNetUserManager.GetById(notification.IdUser);
                var wallet = Task.Run(() => NethereumHelper.CreateUserWallet()).Result;

                user.TokenAddress  = wallet.blobname;
                user.WalletAddress = wallet.walletaddress;

                aspNetUserManager.Update(user);

                MailMessage mailMessage = new MailMessage()
                {
                    Body        = notification.MailContent,
                    Destination = user.Email,
                    Subject     = "Confirm your email"
                };
                mailManager.SendAsync(mailMessage);
            }
            catch (Exception ex)
            {
                var messageException = telemetria.MakeMessageException(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                telemetria.Critical(messageException);
            }
        }
示例#8
0
        public ActionResult ContactConferenceGroup(FormCollection form)
        {
            string      msg      = form["SendMessage"];
            string      userMail = User.Identity.Name;
            MailManager mail     = new MailManager();

            mail.MailTitle         = "Contact from Venue Page";
            mail.ReciveUserAddress = "*****@*****.**";
            mail.UseHtml           = true;
            mail.MailContent       = "<div>You can reply by this address: " +
                                     "<b style=\"\">" + userMail + "</b></div><div><font __editorwarp__=\"1\" style=\"display: inline; font-size: 14px; " +
                                     "font-family: Verdana; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0); font-weight: 400; font-style: normal;\">" +
                                     "<hr></font></div><font __editorwarp__=\"1\" style=\"display: inline; font-size: 14px; font-family: Verdana; " +
                                     "color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0); font-weight: 400; font-style: normal;\"><div style=" +
                                     "\"display: block; font-size: 14px; font-family: Verdana; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);" +
                                     " font-weight: 400; font-style: normal;\">The contact text from Venue page is:</div><blockquote style=\"margin: " +
                                     "0.8em 0px 0.8em 2em; padding: 0px 0px 0px 0.7em; border-left: 2px solid rgb(221, 221, 221);\" formatblock=\"1\">" +
                                     msg +
                                     "</blockquote></font><div></div><div><includetail><!--<![endif]--></includetail></div>";
            if (mail.Send())
            {
                ViewBag.SendSuccessFlag = true;
            }
            return(View("Venue"));
        }
示例#9
0
 public EnviarEmailViewModel(MailManager mailManager, IConfiguracaoService configuracaoService, INotaFiscalRepository notaFiscalRepository)
 {
     EnviarEmailCmd        = new RelayCommand <IClosable>(EnviarEmailCmd_Execute, EnviarEmailCmd_CanExecute);
     _mailManager          = mailManager;
     _configuracaoService  = configuracaoService;
     _notaFiscalRepository = notaFiscalRepository;
 }
示例#10
0
 public FrmMain()
 {
     InitializeComponent();
     _banManager    = new BanManager(new AdoBanDal());
     _mailManager   = new MailManager(new AdoMailDal());
     _reportManager = new ReportManager(new AdoReportDal());
 }
示例#11
0
        private void SendMailCheckResponse(PUP p)
        {
            //
            // "Pup Contents: A string specifying the mailbox name."
            //

            //
            // See if there is any mail for the specified mailbox.
            //
            string mailboxName = Helpers.ArrayToString(p.Contents);

            //
            // If mailbox name has a host/registry appended, we will strip it off.
            // TODO: probably should validate host...
            //
            mailboxName = Authentication.GetUserNameFromFullName(mailboxName);

            IEnumerable <string> mailList = MailManager.EnumerateMail(mailboxName);

            if (mailList == null || mailList.Count() == 0)
            {
                PUPPort localPort   = new PUPPort(DirectoryServices.Instance.LocalHostAddress, p.DestinationPort.Socket);
                PUP     noMailReply = new PUP(PupType.NoNewMailExistsReply, p.ID, p.SourcePort, localPort, new byte[] { });

                Router.Instance.SendPup(noMailReply);
            }
            else
            {
                PUPPort localPort = new PUPPort(DirectoryServices.Instance.LocalHostAddress, p.DestinationPort.Socket);
                PUP     mailReply = new PUP(PupType.NewMailExistsReply, p.ID, p.SourcePort, localPort, Helpers.StringToArray("You've got mail!"));

                Router.Instance.SendPup(mailReply);
            }
        }
        public ActionResult Order(List <OrderProductDTO> productsList, int?Total, int?Id)
        {
            var user   = Session["User"] as User;
            var UserId = user.UserId;



            var manager = new DBManager("ValuesTest");
            var DTOList = new List <ProductPurchaseDTO>();

            foreach (var item in productsList)
            {
                DTOList.Add(new ProductPurchaseDTO()
                {
                    quantity = item.quantity, product_id = item.product_id
                });
            }


            var success = manager.PurchaseProducts(UserId, DTOList, Total ?? 0);

            if (success != -1)
            {
                var orderDetails = manager.GetOrderById(success);

                MailManager.InformUser(user, orderDetails);
            }
            return(Content(success.ToString()));
        }
示例#13
0
        protected void btnRequestCatalogue_Click(object sender, EventArgs e)
        {
            StringBuilder emailContent = new StringBuilder();
            emailContent.Append("<p>Direct Sports - Catalogue Request</p>");
            emailContent.Append("<p>Please send a catalogue for the following sports: </p>");

            foreach (ListItem li in clSports.Items)
            {
                if (li.Selected)
                {
                    emailContent.Append(li.Text + "<br />");
                }
            }

            emailContent.Append("<p>Please send a the catalogue(s) to: </p>");
            emailContent.Append("<p>");
            emailContent.Append(txtName.Text + "<br />");
            emailContent.Append(txtAddress1.Text + "<br />");
            emailContent.Append(txtAddress2.Text + "<br />");
            emailContent.Append(txtAddress3.Text + "<br />");
            emailContent.Append(txtPostcode.Text + "<br />");

            //send email
            MailManager manager = new MailManager();
            List<string> addresses = new List<string>(2);
            addresses.Add(WebConfigurationManager.AppSettings["AdminEmailAddress"]);
            addresses.Add(WebConfigurationManager.AppSettings["CatalogueEmailAddress"]);
            log.Info(emailContent.ToString());
            int numberSent;
            manager.SendEmail(addresses, "Direct Sports - Catalogue Request", WebConfigurationManager.AppSettings["AdminEmailAddress"], emailContent.ToString(), true, out numberSent);
            lblCatalogueRequestResult.Visible = true;
        }
示例#14
0
        public IHttpActionResult Submit()
        {
            try
            {
                var request = Context.AuthenticatedRequest;
                if (!request.IsAdminLoggin || !request.AdminPermissions.HasSystemPermissions(Plugin.PluginId))
                {
                    return(Unauthorized());
                }

                var config = Plugin.GetConfigInfo();

                var address     = request.GetPostString("address");
                var displayName = request.GetPostString("displayName");
                var title       = request.GetPostString("title");
                var body        = request.GetPostString("body");

                if (!MailManager.Send(config, address, displayName, title, body, out var errorMessage))
                {
                    return(BadRequest(errorMessage));
                }

                return(Ok(new { }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
示例#15
0
        public ActionResult SignUp(SignUpVm data)
        {
            var mailManager = new MailManager();

            if (ModelState.IsValid)
            {
                var userManager = service.Uow.Users;
                userManager.Create(new AppUser {
                    Email    = data.Email,
                    UserName = data.SignupUsername,
                    EmailVerificationCode = Guid.NewGuid().ToString(),
                    ProfilePicPath        = "/Content/Images/ProfilePics/default-pp.jpg",
                    ProfilePicUploadDate  = DateTime.Now,
                    IsActive = true
                }, data.SignupPassword);

                var user = userManager.FindByName(data.SignupUsername);
                userManager.AddToRole(user.Id, "default_user");

                Uri    uri         = new Uri(Request.Url.ToString());
                string mailSubject = "Restoran İnceleme E-posta Aktivasyonu";
                string mailBody    = "Lütfen bağlantıya tıklayarak üyeliğinizi aktif ediniz: " + uri.GetLeftPart(UriPartial.Authority) + "/account/mailverify?username="******"&confirmationCode=" + user.EmailVerificationCode;
                mailManager.SendMail("*****@*****.**", "xxxxxxxx", data.Email, mailSubject, mailBody);

                return(RedirectToAction("Index", "Home"));
            }
            return(RedirectToAction("Index", "Home"));
        }
示例#16
0
        public ActionResult ForgetPassword([FromBody] ForgetPasswordRequest request)
        {
            var control  = userRepo.FirstOrDefaultBy(x => x.Username == request.Username && x.Email == request.Email);
            var response = new BaseResponse <bool>();

            if (control == null)
            {
                response.SetMessage("Sistemde kayıtlı böyle bir kullanıcı bulunamadı.");
                return(Ok(response));
            }

            Random rnd               = new Random();
            int    passwordKey       = rnd.Next(10000000, 99999999);
            string passwordKeyString = Convert.ToString(passwordKey);

            passwordKeyString = new Cryptography().EncryptString(passwordKeyString);

            var forgotPassword = new ForgatPassword();

            forgotPassword.UserID = control.Id;
            forgotPassword.Key    = passwordKeyString;
            forgatPasswordRepo.Add(forgotPassword);


            var resetLink = "http://localhost:5001/Login/RePassword?Code=" + HttpUtility.UrlEncode(passwordKeyString);


            MailManager.Send(resetLink, control.Email);

            return(Ok(response));
        }
示例#17
0
        public ActionResult Withdraw(int Id)
        {
            AbstractManager manager = new AbstractManager();

            if (manager.Withdraw(Id))
            {
                TempData["AlertType"]    = "SUCCESS";
                TempData["AlertContent"] = "Your abstract has been successfully withdrawn.";
            }
            else
            {
                TempData["AlertType"]    = "DANGER";
                TempData["AlertContent"] = "Oops! Something Wrong! Please Try Again!";
            }
            MailBrief   brief = manager.GetMailBrief(Id);
            MailManager mail  = new MailManager();
            string      html  = "<h2>The abstract you submitted has been <strong>withdraw by yourself</strong>.</h2><hr />" +
                                "Title:" + brief.Title + "<br />" +
                                "Id:" + brief.GroupId + "-" + brief.Id + "<br />" +
                                "Creation Time:" + brief.SubmitTime + "<br />" +
                                "Operation Time:" + DateTime.Now + "<hr />" +
                                "Operation IP Address:" + Request.UserHostAddress + "<hr />" +
                                "Any requests please get in touch:<a href=\"mailto: incise2018 @sustc.edu.cn\">[email protected]</a>";

            mail.ReciveUserAddress = brief.MailAddress;
            mail.MailTitle         = "Abstract‘s Status Update";
            mail.MailContent       = html;
            mail.UseHtml           = true;
            mail.Send();
            return(View("MyAbstract", GetMyAbstract()));
        }
示例#18
0
        public async Task <bool> DeleteMeetingAsync(string account, string password, string id)
        {
            var mailManager = MailManager.Create(account, password);
            var result      = await mailManager.DeleteMeetAsyun(id);

            return(result);
        }
示例#19
0
 // Pass the MailManager object to the constructor
 public Pager(MailManager mm)
 {
     // Construct an instance of the ProcessMailMsgEventHandler
     // delegate that refers to our SendMsgToPager callback method.
     // Register our callback with MailManager's ProcessMailMsg event
     mm.NewMail += SendMsgToPager;
 }
示例#20
0
 // Pass the MailManager object to the constructor
 public Fax(MailManager mm)
 {
     // Construct an instance of the EventHandler<NewMailEventArgs>
     // delegate that refers to our FaxMsg callback method.
     // Register our callback with MailManager's NewMail event
     mm.NewMail += FaxMsg;
 }
        protected void btnRequestCatalogue_Click(object sender, EventArgs e)
        {
            StringBuilder emailContent = new StringBuilder();
            emailContent.Append("<p>Direct Sports - Information Request</p>");
            emailContent.Append("<p>Please respond to the below customer request: </p>");

            emailContent.Append("<p>");
            emailContent.Append("Customer E-Mail Address: ");
            emailContent.Append(txtEmail.Text);
            emailContent.Append("</p>");

            emailContent.Append("<p>");
            emailContent.Append(txtRequest.Text);
            emailContent.Append("</p>");

            //send email
            MailManager manager = new MailManager();
            List<string> addresses = new List<string>(2);
            addresses.Add(WebConfigurationManager.AppSettings["AdminEmailAddress"]);
            addresses.Add(WebConfigurationManager.AppSettings["CatalogueEmailAddress"]);
            log.Info(emailContent.ToString());
            int numberSent;
            manager.SendEmail(addresses, "Direct Sports - Information Request", WebConfigurationManager.AppSettings["AdminEmailAddress"], emailContent.ToString(), true, out numberSent);
            lblCatalogueRequestResult.Visible = true;
        }
示例#22
0
 // Передаем конструктору объект MailManager
 public Fax(MailManager mm)
 {
     // Создаем экземпляр делегата EventHandler<NewMailEventArgs>,
     // ссылающийся на метод обратного вызова FaxMsg
     // Регистрируем обратный вызов для события NewMail объекта MailManager
     mm.NewMail += FaxMsg;
 }
示例#23
0
        public IHttpActionResult EmailVarification(string email)
        {
            try
            {
                var user = _userService.GetUsers(x => x.Email == email && x.IsActive).FirstOrDefault();

                if (user != null)
                {
                    Random rnd  = new Random();
                    int    code = rnd.Next(1000, 9999);
                    user.Code       = code;
                    user.IsCodeUsed = false;
                    user.CodeExpiry = DateTime.Now.AddMinutes(5);
                    string strBody = "<HTML><BODY><P><font color='#4e0145' face='verdana' size='2'>Hi " + user.LastName + " " + user.FirstName + ",<BR /> <BR />";
                    strBody = strBody + "You've requested to reset your password, please find it below:<BR /><BR /> ";
                    strBody = strBody + "your verification code: " + code + " <BR /><BR />";
                    strBody = strBody + "***Please do not reply to this system generated email.<BR /><BR />";
                    strBody = strBody + "Regards,<BR />Smart Reports</font></P></BODY></HTML>";

                    _userService.UpdateUser(user);
                    MailManager.SendVerificationCode(user, strBody);
                }
                else
                {
                    return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NotFound, "Email does not exist.")));
                }

                return(Ok());
            }
            catch (Exception ex)
            {
                return(ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)));
            }
        }
示例#24
0
        public IActionResult Index(BUser buser)
        {
            UserManager um = new UserManager();

            if (um.validate_user(buser))
            {
                string umail = um.getMail(buser.Username);
                buser.Mail = umail;
                MailManager mailManager = new MailManager();

                BMailBot bMailBot = mailManager.getBMailBot();

                /*if(DateTime.Now > um.getLastSent(buser.Username).AddDays(1))
                 * {
                 *  NotificationManager cm = new NotificationManager();
                 *  string message = cm.generateMessage(um.getId(buser.Username));
                 *  mailManager.sendMail(bMailBot.Username, bMailBot.Password, umail, "Report", message);
                 *  um.updateLastSent(um.getId(buser.Username));
                 *
                 * }*/

                //using Observer Design Pattern to notify the user of items that expired.
                ConcreteSubject cs = new ConcreteSubject();
                cs.Attach(buser);
                //cs.Notify();

                BUsername u = new BUsername(buser.Username);
                return(RedirectToAction("Index", "MainPage", u));
            }
            ViewData["message"] = "Invalid Username or Password";
            return(View());
        }
示例#25
0
        private void SendMail(Models.Register userModel)
        {
            var         b  = System.Text.Encoding.UTF8.GetBytes(userModel.Email);
            string      v  = Convert.ToBase64String(b);
            MailManager mm = new MailManager();

            mm.EmailBodyHTML = @"
                <p style='font-size:12px;font-style:italic;'>
                    Dit is een automatisch gegenereerd bericht. Gelieve niet te antwoorden daar er niet geantwoord zal worden.
                </p>
                <h1>RADAR </h1>
                <p>U hebt u geregistreerd op Radar, Welkom!</p> 
                <p> Klik op de activatielink op je profiel te activeren: <a href='" + Url.Action("Activate", "Account", new { activationkey = v }, Request.Url.Scheme) + "'>Activeer je account bij RADAR</a>.</p>";
            MailAddress ma = new MailAddress("*****@*****.**");

            mm.EmailFrom    = ma;
            mm.EmailSubject = "Radar - Registratie";
            MailAddress        mas    = new MailAddress(userModel.Email);
            List <MailAddress> masses = new List <MailAddress>();

            masses.Add(mas);
            mm.EmailTos     = masses;
            mm.SmtpHost     = WebConfigurationManager.AppSettings["SMTPHost"];
            mm.SmtpPort     = Convert.ToInt32(WebConfigurationManager.AppSettings["SMTPPort"]);
            mm.IsSSL        = true;
            mm.SmtpLogin    = WebConfigurationManager.AppSettings["SMTPEmail"];
            mm.SmtpPassword = WebConfigurationManager.AppSettings["SMTPPassword"];
            mm.SendMail();
        }
示例#26
0
        private void button3_Click(object sender, EventArgs e)//send
        {
            //"smtp.wp.pl", 587, "Test", "TESTTET", "*****@*****.**", "Filipvirus", "*****@*****.**"
            MailManager mailManager = new MailManager("smtp.wp.pl", 587, "Test", keyGenereator.MagicWord, "*****@*****.**", "Filipvirus", "*****@*****.**");

            mailManager.Send();
        }
        public override void run()
        {
            L2Player player = Client.CurrentPlayer;

            if (!player.isInPeace())
            {
                player.sendSystemMessage(3066); //You cannot receive or send mail with attached items in non-peace zone regions.
                player.sendActionFailed();
                return;
            }

            MailMessage mm = MailManager.getInstance().getMessageNotmy(player.ObjID, MailID);

            if (mm == null)
            {
                player.sendMessage("Your mail #" + MailID + " was not found.");
                player.sendActionFailed();
                return;
            }

            mm.NotOpend = 0;

            player.sendPacket(new ExShowReceivedPost(mm));
            player.sendPacket(new ExChangePostState(true, MailID, ExChangePostState.Readed));
        }
        public IActionResult NewsLetter([FromBody] AddRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(Ok(ModelState));
            }

            var response = new BaseResponse <Guid>();

            var item = new Newsletter
            {
                Email = request.Email,
            };

            newsletterRepo.Add(item);
            response.Message = "Kayıt başarıyla eklenmiştir.";
            response.Data    = item.Id;

            var MailBody = "HepsiSef bize ulaşın + E-Bülten" + "\n " + " " + item.Email + "\n";

            List <AdminMailMM> Admins = new List <AdminMailMM>();

            Admins = userRepo.GetBy(x => x.Role == Role.Admin).Select(x => new AdminMailMM
            {
                Email = x.Email
            }).ToList();

            foreach (var mail in Admins)
            {
                MailManager.Send(MailBody, mail.Email);
            }

            return(Ok(response));
        }
示例#29
0
    /// <summary> 출석 서버 통신 </summary>
    public IEnumerator ServerConnect()
    {
        Instance.isAttendance = false;

        string  result = "";
        string  php    = "Attendance.php";
        WWWForm form   = new WWWForm();

        form.AddField("userID", User.Instance.userID);
        form.AddField("type", (int)AttendancePHPtype.Reading);

        yield return(Instance.StartCoroutine(WebServerConnectManager.Instance.WWWCoroutine(php, form, x => result = x)));

        if (string.IsNullOrEmpty(result))
        {
            yield break;
        }

        if (result == "add")
        {
            if (isInitialized)
            {
                yield return(StartCoroutine(MailManager.MailDataInitCoroutine()));
            }
            else
            {
                UIAttendance.isLogin = true;
            }

            Instance.isAttendance = true;
        }
        yield return(null);
    }
示例#30
0
    IEnumerator GetRewardUserQuestComplete(int missionNum)
    {
        string  php  = "UserQuest.php";
        WWWForm form = new WWWForm();

        form.AddField("userID", User.Instance.userID);
        form.AddField("missionNum", missionNum);
        form.AddField("type", 3);
        string result = string.Empty;

        yield return(StartCoroutine(WebServerConnectManager.Instance.WWWCoroutine(php, form, x => result = x)));

        if (!string.IsNullOrEmpty(result))
        {
            Debug.LogError("개별 유저미션 완료되면 안되는데 완료됨");
        }
        else
        {
            UserQuestManager.Instance.isMissionComplete[missionNum - 1] = false;
            UserQuestManager.Instance.isMissionRewarded[missionNum - 1] = true;
            UIPopupManager.ShowOKPopup("미션 완료", "신규 유저 미션완료 보상을 우편으로 전송했습니다.\n확인해주세요", null);

            yield return(StartCoroutine(MailManager.MailDataInitCoroutine()));
        }

        //InitUI();
        //UIUserQuest.Instance.InitUI();
        getRewardCoroutine = null;
        yield break;
    }
示例#31
0
        public IActionResult Get()
        {
            try
            {
                string p = $@"{Directory.GetCurrentDirectory()}/Templates/Demo.html";
                // string templatePath = $@"{Directory.GetCurrentDirectory()}\EmailTemplates";
                var builder = new StringBuilder();

                using (var reader = System.IO.File.OpenText(p))
                {
                    builder.Append(reader.ReadToEnd());
                }

                builder.Replace("{{user-name}}", "CHINO!");

                var server   = _configuration["Mailer:SmtpServer"];
                var port     = _configuration["Mailer:SmtpPort"];
                var user     = _configuration["Mailer:SmtpUser"];
                var password = _configuration["Mailer:SmtpPassword"];

                var mailer = new MailManager(server, Convert.ToInt32(port), user, password);


                GlobalMessage r = mailer.Send(builder.ToString());

                _logger.LogInfo($"EMAIL: {r.ToString()}");
                return(Ok(r.ToString()));
            }
            catch (Exception ex)
            {
                _logger.LogInfo(ex, $"EMAIL:");
                return(Ok(GlobalMessage.FailResult($"cannot.send", ex)));
            }
        }
示例#32
0
        /// <summary>
        /// Publishes all scheduled items for time period
        /// </summary>
        /// <param name="fromDate">Start of the period</param>
        /// <param name="toDate">End of the period</param>
        private void PublishSchedules(DateTime fromDate, DateTime toDate)
        {
            IEnumerable <PublishSchedule> duePublishSchedules = _scheduledPublishRepo.GetUnpublishedSchedules(fromDate, toDate);

            if (duePublishSchedules == null)
            {
                Log.Info(string.Format("Scheduled Publish: No publish schedules from {0} to {1}",
                                       fromDate.ToString(Context.Culture),
                                       toDate.ToString(Context.Culture)), this);
                return;
            }

            foreach (var schedule in duePublishSchedules)
            {
                Handle handle = ScheduledPublishManager.Publish(schedule);
                ScheduledPublishReport report = ScheduledPublishManager.GetScheduledPublishReport(handle);
                if (report.IsSuccessful)
                {
                    MarkAsPublished(schedule);
                }

                if (ScheduledPublishSettings.IsSendEmailChecked)
                {
                    try
                    {
                        MailManager.SendEmail(report.Message, schedule.ItemToPublish, schedule.SchedulerUsername);
                    }
                    catch (Exception ex)
                    {
                        Log.Error(string.Format("{0} {1}", "Scheduled Publish: Sending publish email confirmation failed.", ex), schedule);
                    }
                }
            }
        }
示例#33
0
        private static void Main()
        {
            MailManager prograMailManager = new MailManager();

            prograMailManager.MailArrived += (sender, args) =>
            {
            };

            var timer = new Timer(state => prograMailManager.SimulateMailArrival(), null, 0, 1000);
            Console.ReadLine();
        }
示例#34
0
        public async Task<IHttpActionResult> Send()
        {
            try
            {
                // Validate request header
                var token = Request.Headers.GetValues("DBVibe.Security.Token").FirstOrDefault();
                if (token == null || token.ToString() != "372a63a2-ff06-4913-b386-b26abf8e335c")
                {
                    return Json("Unauthorized request.");
                }

                // Read post request content
                string content = await Request.Content.ReadAsStringAsync();

                // Serialize json string to json object
                var o = JObject.Parse(content);

                // Parse values from json
                var subject = o["subject"].ToString();
                var name = o["name"].ToString();
                var phone = o["phone"].ToString();
                var email = o["email"].ToString();
                var message = o["message"].ToString();

                // Construct mail body
                var body = string.Format(
                    "Name: {0}<br/>" + 
                    "Phone: {1}<br/>" + 
                    "Email: {2}<br/>" + 
                    "Message: {3}<br/>",
                    name,
                    phone,
                    email,
                    message);

                var mailManager = new MailManager();
                mailManager.MailSubject = subject;
                mailManager.MailBody = body;

                mailManager.Send();

                return Json(true);
            }
            catch (Exception ex)
            {
                return Json(ex.Message);
            }
        }
示例#35
0
        public ActionResult SaveContactData(FormCollection collection)
        {
            #region Util function
            // utility function
            Func<FormCollection, string> __getInterests = c =>
            {
                return string.Join(",", posList.Where(q => c[q.OptionName] != null).Select(a => a.Value).ToArray<object>());
                // NOTE: casted as object array to eliminate method abiguity
            };
            #endregion

            var info = new ContactInfo();

            // scrape form data

            info.FullName = collection["name"];
            info.EmailAddress = collection["email"];
            info.PhoneNumber = collection["phone"];
            info.Major = collection["major"];
            info.About = collection["about"];
            info.PreferredContactMethod = collection["contact-pref"];
            info.Interests = __getInterests(collection);
            info.LastUpdated = DateTime.Now;
            info.RequesterID = collection["requesterid"];
            info.GradYear = collection["gradyear"];
            info.JobType = collection["jobtype"];

            if (Session["_ActiveSchool"] != null) {
                var data = (SchoolData)Session["_ActiveSchool"];
                info.School = data.Alias;
            }

            if (Request.Files.Count > 0)
            {
                var file = Request.Files[0];
                if (!string.IsNullOrWhiteSpace(file.FileName))
                {
                    info.UploadKey = string.Format("{0}-{1:yyyyMMddHHmmss}{2}", info.RequesterID, DateTime.Now, Path.GetExtension(file.FileName));
                    repo.SaveAttachment(info.UploadKey, file.InputStream);
                }
            }

            var mm = new MailManager();
            mm.NotifySave(info);

            // add cookies
            Response.Cookies[CookieNames.LastUpdated].Value = info.LastUpdated.ToString();
            Response.Cookies[CookieNames.FullName].Value = info.FullName;
            Response.Cookies[CookieNames.EmailAddress].Value = info.EmailAddress;
            Response.Cookies[CookieNames.Phone].Value = info.PhoneNumber;
            Response.Cookies[CookieNames.Major].Value = info.Major;
            Response.Cookies[CookieNames.About].Value = info.About;
            Response.Cookies[CookieNames.Interests].Value = info.Interests;
            Response.Cookies[CookieNames.PreferredContactMethod].Value = info.PreferredContactMethod;
            Response.Cookies[CookieNames.RequesterID].Value = info.RequesterID;
            Response.Cookies[CookieNames.GradYear].Value = info.GradYear;
            Response.Cookies[CookieNames.JobType].Value = info.JobType;

            CookieNames.SetResponseLifetime(Response, 365); // in days

            // save contact info
            repo.SaveContact(info);

            HttpContext.Cache.Add("Saved", true, null, DateTime.Now.AddSeconds(15), Cache.NoSlidingExpiration, CacheItemPriority.Default, null);

            return RedirectToAction("Index");
        }