public void SendConfirmationEmail(Models.AppointmentDTO appointment)
        {
            _logger.LogInformation($"Sending email to confirm appointment: {appointment}");
            string confirmUrl = $"http://*****:*****@thevetclinic.com";
            string subject    = "Vet Appointment Confirmation for " + appointment.PatientName;
            string body       = String.Format("<html><body>Dear {0},<br/><p>Please click the link below to confirm {1}'s appointment for a {2} with {3} on {4}.</p><p>Thanks!</p><p><a href='{5}'>CONFIRM</a></p><p>Please call the office to reschedule if you will be unable to make it for your appointment.</p><p>Have a great day!</p></body></html>", appointment.ClientName, appointment.PatientName, appointment.AppointmentType, appointment.DoctorName, appointment.AppointmentStartDateTime.ToString(), confirmUrl);

            _emailSender.SendEmail(to, from, subject, body);
        }
コード例 #2
0
 public void SendConfirmationEmail(Models.AppointmentDTO appointment)
 {
     using (var client = new SmtpClient("localhost"))
     {
         var mailMessage = new MailMessage();
         mailMessage.To.Add(appointment.ClientEmailAddress);
         mailMessage.From       = new MailAddress("*****@*****.**");
         mailMessage.Subject    = "Vet Appointment Confirmation for " + appointment.PatientName;
         mailMessage.IsBodyHtml = true;
         mailMessage.Body       = String.Format("<html><body>Dear {0},<br/><p>Please click the link below to confirm {1}'s appointment for a {2} with {3} on {4}.</p><p>Thanks!</p><p><a href='{5}'>CONFIRM</a></p><p>Please call the office to reschedule if you will be unable to make it for your appointment.</p><p>Have a great day!</p></body></html>", appointment.ClientName, appointment.PatientName, appointment.AppointmentType, appointment.DoctorName, appointment.Start.ToString(), "http://localhost:51322/appointment/confirm/" + appointment.AppointmentId);
         client.Send(mailMessage);
     }
 }