コード例 #1
0
ファイル: Email.cs プロジェクト: QTruffart/OsteoYoga
        public virtual void SendForAdminValidation(Date date)
        {
            var toAddress = new MailAddress(Constants.GetInstance().MailNico, Constants.GetInstance().NomNico);

            string body = string.Format("<html><head></head><body>Bonjour, <br /><br />La demande de rendez-vous a été validée <br /><br />" + "Resumé du rendez-vous : " + "Date : {0}<br />" + "Horaire : {1} <br />" + "Patient : {2}</body></html>", date.Day.ToString("dd/MM/yyyy"), date.TimeSlot, date.Contact);

            var smtp = new SmtpClient
            {
                Host = SmtpOsteoyogaFr,
                Port = Port,
                EnableSsl = ssl,
                DeliveryMethod = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials = new NetworkCredential(fromAddress.Address, Constants.GetInstance().PassMail)
            };
            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = Subject + date.Day.ToString(FormatDate),
                Body = body,
                IsBodyHtml = true
            })
            {
                smtp.Send(message);
            }
        }
コード例 #2
0
ファイル: Email.cs プロジェクト: QTruffart/OsteoYoga
        public virtual void SendForPatientPropose(Date date, string serverAddress)
        {
            var toAddress = new MailAddress(date.Contact.Mail, date.Contact.FullName);

            string body = string.Format("<html><head></head><body>Bonjour, <br /><br />Votre demande a été proposée. Vous devez cliquer sur le lien suivant pour valider votre rendez-vous : <br /><a href='{0}/RendezVous/Validate?id={1}'>Lien Ici !</a> <br /><br />" + "Resumé du rendez-vous : " + "Date : {2}<br />" + "Horaire : {3} <br />" + "Patient : {4} <br /><br /> Cordialement,<br />Nicolas Truffart</body></html>", serverAddress, date.ConfirmationId, date.Day.ToString("dd/MM/yyyy"), date.TimeSlot, date.Contact);

            var smtp = new SmtpClient
            {
                Host = SmtpOsteoyogaFr,
                Port = Port,
                EnableSsl = ssl,
                DeliveryMethod = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials = new NetworkCredential(fromAddress.Address, Constants.GetInstance().PassMail)
            };
            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = Subject + date.Day.ToString(FormatDate),
                Body = body,
                IsBodyHtml = true
            })
            {
                smtp.Send(message);
            }
        }