Beispiel #1
0
        public void SendUser(string destination)
        {
            var template = contentCreator.Create(
                mailSubjects.AccountConfirmationUser,
                "AccountConfirmationUser.html",
                new Dictionary <string, string>()
            {
                { "Name", Name },
                { "Url", Url }
            }
                );

            mailer.Send(destination, template.Subject, template.Content);
        }
Beispiel #2
0
        public ActionResult ThankYou(int?id, string email, int orderId)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Showing showing = repo.GetById <Showing>(id);

            if (showing == null)
            {
                return(HttpNotFound());
            }

            try
            {
                MailMessage mail = new MailMessage();
                mail.To.Add(new MailAddress(email));
                mail.Body       = String.Format($"Bedankt voor uw bestelling bij Avans Bioscopen! Uw ordernummer is: {orderId}. Veel kijkplezier!");
                mail.IsBodyHtml = true;
                mailer.Send(mail);
            }
            catch (Exception e)
            {
                Response.Write("Error " + e.ToString());
            }

            ViewBag.ShowingID = id;

            return(View(showing));
        }
        public ActionResult Signup(string Email)
        {
            NewsletterSignup signup = repo.GetFirst <NewsletterSignup>(ns => ns.Email == Email);

            if (signup == null)
            {
                signup = new NewsletterSignup()
                {
                    Email = Email, VerificationToken = tokenGenerator.Generate(16), Verified = false
                };
                repo.Create <NewsletterSignup>(signup);
            }
            else
            {
                signup.VerificationToken = tokenGenerator.Generate(16);
                repo.Update <NewsletterSignup>(signup);
            }
            repo.Save();

            MailMessage mail = new MailMessage();

            mail.To.Add(new MailAddress(Email));
            var link = new Uri(HttpContext.Request.Url, Url.Action("Verify", new { token = signup.VerificationToken }));

            mail.Body       = String.Format("Welkom bij de CinemaTicketSystem nieuwsbrief,<br><a href=\"{0}\">Valideer je e-mailadres.</a>", link);
            mail.IsBodyHtml = true;
            mailer.Send(mail);

            return(View(signup));
        }
Beispiel #4
0
 public void Run(string[] args)
 {
     foreach (var data in dataProvider.GetData())
     {
         mailer.Send(data);
     }
 }
Beispiel #5
0
        public void SendEmail()
        {
            if (string.IsNullOrWhiteSpace(Name))
            {
                throw new ArgumentNullException("Email not found");
            }

            _mailer.Send(Email);
        }
Beispiel #6
0
        public IActionResult Post([FromBody] Order order)
        {
            if (order == null)
            {
                return(BadRequest());
            }
            _db.Orders.Add(order);
            _db.SaveChanges();
            _mailer.Send(order.Customer.Email, "New Order", "You have placed a new order");

            return(CreatedAtRoute("GetOrder", new { id = order.id }, order));
        }
        public void Send(string destination)
        {
            var mailContent = contentCreator.Create(
                this.mailSubjects.PasswordReset,
                templateFileName,
                new Dictionary <string, string>()
            {
                { "Name", Name },
                { "Url", Url }
            }
                );

            mailer.Send(destination, mailContent.Subject, mailContent.Content);
        }
Beispiel #8
0
        public Task HandleMessage(IMessagePayload <IMessageData> baseMessage, JsonSerializerSettings serializerSettings)
        {
            switch (baseMessage.Type)
            {
            case MessageType.CovidNotification:
            {
                var details = baseMessage.Data as CovidNotification;
                return(_mailer.Send(MailFactory.Create(details.EmailAddress, details.Title, details.Message)));
            }

            default:
                throw new ArgumentException();
            }
        }
Beispiel #9
0
        public Task SendEmailConfirmationEmail(string email, string token)
        {
            var link = UriUtils.AddQueryArguments(
                _routesOptions.EmailConfirmationUri.ToString(),
                ("email", email),
                ("token", token));

            return(_mailer.Send(new MailData
            {
                To = email,
                Subject = _stringLocalizer["ConfirmEmail_Subject"],
                Body = _stringLocalizer["ConfirmEmail_BodyTemplate", link],
            }));
        }
        public void Send(string destination)
        {
            var mailContent = contentCreator.Create(
                mailSubjects.ContactFormMessageConfirmation,
                templateFilteName,
                new Dictionary <string, string>()
            {
                { "Email", Email },
                { "Subject", Subject },
                { "Content", Content }
            }
                );

            mailer.Send(destination, mailContent.Subject, mailContent.Content);
        }
        public async Task <IActionResult> MailSender(SendingDataViewModel model)
        {
            var posts = _context.Mails.ToList();

            var post = _mapper.Map <Mail, MailViewModel>(posts[0]);

            await _mailer.Send(model.ToMailAdr, model.ToName, post.TemplateId, new
            {
                Subject  = model.Subject,
                Title    = model.Title,
                Subtitle = model.SubTitle
            });

            return(Ok());
        }
Beispiel #12
0
        public async Task <IActionResult> Send([FromBody] SendEmailCommand command)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var from    = new EmailAddress(_configuration["Mailgun:Sender:Name"], _configuration["Mailgun:Sender:Email"]);
            var to      = new EmailAddress(_configuration["Mailgun:Reciever:Name"], _configuration["Mailgun:Reciever:Email"]);
            var body    = $"{command.Name} ({command.Email}) send the following: {command.Message}<br />";
            var message = new EmailMessage(from, to, "Message from website", body);

            await _mailer.Send(message);

            return(Ok());
        }
        public async Task <bool> Run()
        {
            var to = _taskEmailRecipientRepo
                     .Where(i => i.TaskType == TaskTypeEnum.MorningEmailTask)
                     .Select(i => i.EmailAddress)
                     .ToList();

            var events      = GetEvents(10); // TODO: un-hardcode this
            var feedings    = GetFeedings();
            var amFeedings  = feedings.Where(f => f.AMFeeding).ToList();
            var pmFeedings  = feedings.Where(f => f.PMFeeding).ToList();
            var medications = GetMedications();
            var amMeds      = medications.Where(m => m.AMDose).ToList();
            var noonMeds    = medications.Where(m => m.NoonDose).ToList();
            var pmMeds      = medications.Where(m => m.PMDose).ToList();

            var lists = new Dictionary <string, IList>
            {
                { "Upcoming Events", events },
                { "AM Feedings", amFeedings },
                { "PM Feedings", pmFeedings },
                { "AM Medications", amMeds },
                { "Noon Medications", noonMeds },
                { "PM Medications", pmMeds }
            };

            try
            {
                var eb = new EmailBuilder();

                eb.To(to)
                .From(_from)
                .WithSubject(_subject)
                .WithBody(lists);

                var email = eb.ToViewModel();

                await _mailer.Send(email);
            }
            catch
            {
                return(false);
            }
            return(true);
        }
 public void Register(ValidCustomer validCustomer)
 {
     _mailer.Send();
 }
Beispiel #15
0
        private void EnvoyerRapportMail(IEnumerable <InfosTraitementParution> infosParutions)
        {
            string mailBody = _générateurRapportMail.RapportMail(infosParutions);

            _mailer.Send("Rapport Cabs auto", mailBody);
        }
 public void SendMail(EmailInfo emailInfo)
 {
     _mailer.Send(emailInfo);
 }