コード例 #1
0
 public ActionResult ContactUs(ContactModel model)
 {
     if (ModelState.IsValid)
     {
         string request = (model.Brochure ? "Send Brochure" : "") +
                          (model.Assessment ? "\nProvide Free Logistics Assessment" : "") +
                          (model.Tour ? "\nArrange Retail Sort Center Tour" : "") +
                          (model.CallMe ? "\nCall Me" : "") +
                          (model.EmailMe ? "\nEmail Me" : "");
         string message = model.Name + " has submitted a request for information. \n\n" + request + "\n\n" +
                          "Below is their information:" + "\n" + "==========================" + "\n" +
                          "Name: " + model.Name + "\n" + "Title: " + model.Title + "\n" +
                          "Company: " + model.Company + "\n" + "Address: " + model.Address + "\n" +
                          "Email: " + model.Email + "\n" + "Phone: " + model.Phone + "\n" + "Fax: " + model.Fax;
         EmailServices email = new EmailServices();
         if (email.SendMail(model.Email, "MESSAGE FROM ARGIX DIRECT WEBSITE", message))
         {
             return(RedirectToAction("ThankYou", "Home"));
         }
         else
         {
             ModelState.AddModelError("", "Failed to send contact information; please try again.");
         }
     }
     return(View(model));
 }
コード例 #2
0
        private void EmailSession(Session session)
        {
            if (Request.Url == null)
            {
                return;
            }

            var userid = Thread.CurrentPrincipal.Identity.GetUserId();

            var user = UserManager.FindById(userid);

            var sessionurl = Url.Action("Details", "Sessions", new { id = session.SessionId }, Request.Url.Scheme);

            var subject = "Session " + session.SessionDate.ToString("dddd, MM/dd/yyyy, HH:mm") + " CREATED";
            var body    = "A new pickup session has been created by " + user.FirstName + " " + user.LastName + " for " + session.SessionDate.ToString("dddd, MM/dd/yyyy, HH:mm") + "." + Environment.NewLine + Environment.NewLine;

            if (!string.IsNullOrEmpty(session.Note))
            {
                body += session.Note + Environment.NewLine + Environment.NewLine;
            }
            body += "Click here for the details: " + sessionurl + Environment.NewLine;

            var emailServices = new EmailServices();
            var users         = UserManager.Users.ToList().Where(t => t.Active && t.NotificationPreference != NotificationPreference.None);

            foreach (var u in users)
            {
                emailServices.SendMail(subject, body, u.Email);
            }
        }
コード例 #3
0
 public async Task PostAsync([FromBody] EmailVM emailVM)
 {
     try
     {
         await EmailServices.SendMail(emailVM);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #4
0
        private void SendSessionEmail(Session session, ApplicationUser seller, ApplicationUser buyer, SessionAction sessionAction, BuySell buySell)
        {
            if (Request.Url == null)
            {
                return;
            }

            var sessionurl = Url.Action("Details", "Sessions", new { id = session.SessionId }, Request.Url.Scheme);

            switch (sessionAction)
            {
            case SessionAction.Buy:
            case SessionAction.Sell:
            {
                var subject = "Session " + session.SessionDate.ToString("dddd, MM/dd/yyyy, HH:mm") + " SOLD";
                var body    = "Your spot has been sold to " + buyer.FirstName + " " + buyer.LastName + "." + Environment.NewLine + Environment.NewLine;
                body += "Click here for the details: " + sessionurl + Environment.NewLine;
                if (seller.NotificationPreference != NotificationPreference.None)
                {
                    _emailServices.SendMail(subject, body, seller.Email);
                }

                subject = "Session " + session.SessionDate.ToString("dddd, MM/dd/yyyy, HH:mm") + " BOUGHT";
                body    = "You bought a spot from " + seller.FirstName + " " + seller.LastName + ", and your team assignment is " + buySell.TeamAssignment + "." + Environment.NewLine + Environment.NewLine;
                body   += "You are now obligated to pay the seller for their spot immediately. Please visit the site now and click through and complete the payment process. Then, return to the site, and be sure and click the 'Sent' checkbox for your transaction so the buyer knows that you initiated payment." + Environment.NewLine + Environment.NewLine;
                body   += "Your team assignment may change before or during play, so please ensure you bring the opposite jersey to the bench." + Environment.NewLine + Environment.NewLine;
                body   += "Click here for the details: " + sessionurl + Environment.NewLine;
                if (buyer.NotificationPreference != NotificationPreference.None)
                {
                    _emailServices.SendMail(subject, body, buyer.Email);
                }

                break;
            }

            default:
            {
                throw new NotImplementedException();
            }
            }
        }
コード例 #5
0
 public ActionResult ResetPassword(string emailaddress)
 {
     emailServices.SendMail(emailaddress);
     return(Json(new { error = true }));
 }
コード例 #6
0
 public NegotiatedContentResult <string> TestEmail([FromBody] TestEmailRequest request)
 {
     EmailServices.SendMail(request.email_id, "Test mail :  Please ignore", "This is a test mail, Please ignore");
     return(Content(HttpStatusCode.OK, "Notification sent"));
 }
コード例 #7
0
 public void SendTestMail()
 {
     EmailServices.SendMail("*****@*****.**", "test", "test");
 }