Git Repository Public Repository

CPE_learningsite

URLs

Copy to Clipboard

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using System;
using System.Configuration;
using CPE.App.Web.Models;
using System.Net.Mail;
using CPE.App.Api.Models;
using Newtonsoft.Json;

namespace CPE.App.Api.Helpers
{
    public class SendEmailHelper
    {
        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"], courseEmail); 
            SmtpClient client = new SmtpClient();
            client.Port = 25;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            client.Host = "localhost";
            mail.Subject = ConfigurationManager.AppSettings["EmailSubject"];            
            string mailBodyText = CPE.Utilities.Email.RenderEmail(course.ContentUrl, course.CertificateDate, course.Ticket);
            mail.Body = mailBodyText;
            mail.IsBodyHtml = true;
            client.Send(mail);
            return true;
        }

        public static bool SendBadReleaseEmail(ReleaseModel release)
        {
            MailMessage mail = new MailMessage("support@intesolv.com", ConfigurationManager.AppSettings["EmailReceiver"]); //TODO at DEPLOY: needs to be "sswebcast@cpeincmail.com" or better yet, move to config
            SmtpClient client = new SmtpClient();
            client.Port = 25;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            client.Host = "localhost";
            mail.Subject = "A new release wasn't properly updated.";
            mail.Body = "A new release was processed improperly. Please verify the release description field is correct and create a new release." + Environment.NewLine + "Release code: " + release.ReleaseCode;
            client.Send(mail);
            return true;
        }

        public static bool SendProjectConfigFailEmail(string projectCode)
        {
            //not using. ignoring project_created webhooks
            MailMessage mail = new MailMessage("support@intesolv.com", ConfigurationManager.AppSettings["EmailReceiver"]); 
            SmtpClient client = new SmtpClient();
            client.Port = 25;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            client.Host = "localhost";
            mail.Subject = "A new project was not configured properly.";
            mail.Body = "A new project was created but the configuration of the project for tincan failed. " + Environment.NewLine + "Project Code: " + projectCode;
            client.Send(mail);
            return true;
        }
        public static bool SendCertificateGenerationFailedEmail(TinCanStatementModel statement)
        {
            MailMessage mail = new MailMessage("support@intesolv.com", ConfigurationManager.AppSettings["EmailReceiver"]); //TODO at DEPLOY change to "sswebcast@cpeincmail.com"
            SmtpClient client = new SmtpClient();
            client.Port = 25;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            client.Host = "localhost";
            mail.Subject = "Certificate Generation Failure";
            mail.Body = "A user just passed an on-demand course and something went wrong processing their certificate. " + Environment.NewLine
                + "Please find the necessary information below for their Certificate of Completion. We recommend that you call InteSolv Support to update the Certificate Record. "
                + "Certificate information:" + Environment.NewLine 
                + JsonConvert.SerializeObject(statement, Formatting.Indented);
            client.Send(mail);
            return true;

        }
    }
}

Commits for CPE_learningsite/CPE/CPE.App/CPE.App.Api/Helpers/SendEmailHelper.cs

Diff revisions: vs.
Revision Author Commited Message
d90493 ... Diff Diff v.shishlov Sun 29 Aug, 2021 15:28:47 +0000

add ssl 1.2

4cd176 ... v.shishlov Fri 27 Aug, 2021 14:33:17 +0000

initial commit