add ssl 1.2
[CPE_learningsite] / CPE / CPE.App / CPE.App.Api / Helpers / SendEmailHelper.cs
index ee506b2..ec69d3f 100644 (file)
@@ -1,9 +1,5 @@
 ´╗┐using System;
-using System.Collections.Generic;
 using System.Configuration;
-using System.Linq;
-using System.Web;
-using System.IO;
 using CPE.App.Web.Models;
 using System.Net.Mail;
 using CPE.App.Api.Models;
@@ -15,9 +11,16 @@ namespace CPE.App.Api.Helpers
     {
         public static bool SendCertificateEmail(PurchasedCourse course)
         {
+            var courseEmail = course.Email;
+            var emailTest = ConfigurationManager.AppSettings["EmailTest"];
+            if (!string.IsNullOrWhiteSpace(emailTest))
+            {
+                courseEmail = emailTest;
+            }
+
             //elucidat cert email
             var cDate = course.CertificateDate.Value.ToString("yyyyMMdd");
-            MailMessage mail = new MailMessage(ConfigurationManager.AppSettings["EmailSender"], course.Email); 
+            MailMessage mail = new MailMessage(ConfigurationManager.AppSettings["EmailSender"], courseEmail); 
             SmtpClient client = new SmtpClient();
             client.Port = 25;
             client.DeliveryMethod = SmtpDeliveryMethod.Network;