Ejemplo n.º 1
0
        public ActionResult Contact(ContactUsViewModel model)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.SubmitEmailSent = false;
                return(View("AboutUs"));
            }

            // Send email to Scrum Lords for approval
            var email = new MailMessage();

            email.To.Add(_gmailer.GetEmailAddress());
            email.From       = new MailAddress(model.Email);
            email.Subject    = $"Support inquiry received from {model.Name}.";
            email.Body       = $"Received following inquiry from {model.Name}, email address {model.Email}: " + model.Message;
            email.IsBodyHtml = true;

            // Send email and return to view if successful
            if (_gmailer.Send(email))
            {
                ViewBag.SubmitEmailSent = true;
                return(View("AboutUs", model));
            }

            // Email could not be sent, display error
            ViewBag.SubmitEmailSent = false;
            ViewData.ModelState.AddModelError("EmailError", "Unfortunately, your email could not be sent.");
            return(View("AboutUs", model));
        }
Ejemplo n.º 2
0
 public void SendAccountEmail(string emailAddress, string subject, string body)
 {
     var accountEmail = _gMailService.Send(new MailMessage(_gMailService.GetEmailAddress(), emailAddress)
     {
         Subject = subject,
         Body    = body
     });
 }
Ejemplo n.º 3
0
        public ActionResult ClaimVenue(ClaimVenueFormViewModel model)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.SubmitEmailSent = false;
                return(View(model));
            }

            // Send email to Scrum Lords for approval
            var email = new MailMessage();

            email.To.Add(_gMailer.GetEmailAddress());
            email.From    = new MailAddress(model.Email);
            email.Subject = $"Received request to claim venue {model.VenueName}.";
            email.Body    = $"Received below request to claim venue {model.VenueName}:<br />"
                            + $"Name: {model.FirstName} {model.LastName}<br />"
                            + $"Email: {model.Email}<br />"
                            + $"Phone: {model.PhoneNumber}<br />"
                            + $"Company name (if applicable): {model.CompanyName}<br />"
                            + "Proof of ownership document is attached.";
            email.IsBodyHtml = true;

            var attachment = new Attachment(model.Document.InputStream, model.Document.FileName);

            email.Attachments.Add(attachment);

            // Send email and return to view if successful
            if (_gMailer.Send(email))
            {
                ViewBag.SubmitEmailSent = true;
                return(View(model));
            }

            // Email could not be sent, display error
            ViewBag.SubmitEmailSent = false;
            ViewData.ModelState.AddModelError("EmailError", "Unfortunately, your email could not be sent.");
            return(View(model));
        }
Ejemplo n.º 4
0
        void SendMail(IdentityMessage message)
        {
            #region formatter
            string text = string.Format("Please click on this link to {0}: {1}", message.Subject, message.Body);
            string html = "Please confirm your account by clicking this link: <a href=\"" + message.Body + "\">link</a><br/>";

            html += HttpUtility.HtmlEncode(@"Or click on the copy the following link on the browser:" + message.Body);
            #endregion

            MailMessage msg = new MailMessage();
            msg.To.Add(new MailAddress(message.Destination));
            msg.Subject = message.Subject;
            msg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(text, null, MediaTypeNames.Text.Plain));
            msg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(html, null, MediaTypeNames.Text.Html));

            _gMailService.Send(msg);
        }
Ejemplo n.º 5
0
        public void SendMessage(Game game, int playerId, string body, string subject)
        {
            //Initializing Message Details
            string sendingToEmail = "";
            string messageContent = "";

            //Either sending the message to the Creator of the game or the Players in the game
            if (game.ContactId == playerId)
            {
                sendingToEmail = _contactService.GetContactById((int)game.ContactId).Email;
                messageContent = body;
            }
            else
            {
                if (_contactService.GetContactById(playerId) != null)
                {
                    //emailing to the players on the game list
                    sendingToEmail = _contactService.GetContactById(playerId).Email;
                }
                else
                {
                    //email to the venue owner
                    sendingToEmail = _venueOwnerService.GetVenueOwnerById(playerId).Email;
                }
                messageContent = body;
            }

            MailMessage mailMessage = new MailMessage(_gMailer.GetEmailAddress(), sendingToEmail)
            {
                Body    = messageContent,
                Subject = subject
            };

            //Send the Message
            _gMailer.Send(mailMessage);
        }
Ejemplo n.º 6
0
        /*
         * PBI 148 Austin Bergman
         */
        public void SendInvite(Game game, int friendContactId, string body, string subject)
        {
            //find the current logged-on user
            string  email           = User.Identity.GetUserName();
            Contact currContactUser = _contactService.GetContactByEmail(email);

            string sendToEmail    = "";
            string messageContent = "";

            messageContent = body;



            // sending email to the friend
            sendToEmail = _contactService.GetContactById(friendContactId).Email;

            MailMessage mailMessage = new MailMessage(_gMailer.GetEmailAddress(), sendToEmail)
            {
                Body    = messageContent,
                Subject = subject
            };

            _gMailer.Send(mailMessage);
        }