add ssl 1.2
[CPE_learningsite] / CPE / CPE.App / CPE.App.Web / Helpers / SendEmailHelper.cs
1 ´╗┐using System.Configuration;
2 using CPE.App.Web.Models;
3 using System.Net.Mail;
4
5 namespace CPE.App.Web.Helpers
6 {
7     public class SendEmailHelperWeb
8     {
9         public static bool SendCertificateEmail(PurchasedCourse course)
10         {
11             //elucidat cert email
12             var cDate = course.CertificateDate.Value.ToString("yyyyMMdd");
13             MailMessage mail = new MailMessage(ConfigurationManager.AppSettings["EmailSender"], course.Email); 
14             SmtpClient client = new SmtpClient();
15             client.Port = 25;
16             client.DeliveryMethod = SmtpDeliveryMethod.Network;
17             client.UseDefaultCredentials = false;
18             client.Host = "localhost";
19             mail.Subject = ConfigurationManager.AppSettings["EmailSubject"];            
20             string mailBodyText = CPE.Utilities.Email.RenderEmail(course.ContentUrl, course.CertificateDate, course.Ticket);
21             mail.Body = mailBodyText;
22             mail.IsBodyHtml = true;
23             client.Send(mail);
24             return true;
25         }
26     }
27 }