protected void SendEmail(string Text, string ProviderEmail)
    {
        try
        {
            SmtpClient smtpClient = new SmtpClient();
            //Get the SMTP server Address from SMTP Web.conf
            smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER);
            //Get the SMTP post  25;
            smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT));

            MailMessage message = new MailMessage();

            message.From = new MailAddress(LACESUtilities.GetAdminFromEmail());

            //message.To.Add(LACESUtilities.GetAdminToEmail());
            //message.CC.Add(LACESUtilities.GetAdminCCEmail());

            //Get the email's TO from Web.conf
            message.To.Add(ProviderEmail);

            string BCC = LACESUtilities.GetApplicationConstants(LACESConstant.ADMIN_CONTACT_TO_EMAIL);
            message.CC.Add(LACESUtilities.GetApprovedProviderMailTo());

            message.Subject    = "New Courses Added - Pending Approval";
            message.IsBodyHtml = true;
            message.Body       = Text; // Message Body
            if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y")
            {
                smtpClient.Send(message);   //Sending A Mail to Admin
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
            Response.End();
        }
    }
Exemple #2
0
    /// <summary>
    /// Sends mail to admin and provier after submitting provider application
    /// </summary>
    /// <param name="receiverName"></param>
    /// <param name="receiverEmail"></param>
    public static void SendMailsAfterProviderApplicationRenewed(string receiverName, string receiverEmail, string receiverOrg)
    {
        SmtpClient  smtpClient = new SmtpClient();
        MailMessage message    = new MailMessage();

        try
        {
            //Get the SMTP server Address from Web.conf
            smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER);
            //Get the SMTP port from Web.conf
            smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT));

            //SEND MAIL TO ADMIN

            //Get the email's FROM address from Web.conf
            message.From = new MailAddress(LACESUtilities.GetAdminFromEmail());

            //Get the email's TO from Web.conf
            message.To.Add(LACESUtilities.GetApprovedProviderMailTo());

            //message.CC.Add(new MailAddress("*****@*****.**", "*****@*****.**"));
            //Get the email's Subject
            message.Subject = "Provider has been renewed";

            //Whether the message body would be displayed as html or not
            message.IsBodyHtml = true;

            //Get the email's BODY
            message.Body = "Dear Admin,<br /><br />" + HttpUtility.HtmlEncode(receiverName) + " (" + receiverEmail + ") from " + receiverOrg + " has renewed provider application.<br />Please review and send feedback.<br /><br />Thank you.";

            //Send the mail to admin
            if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y")
            {
                smtpClient.Send(message);
            }

            //SEND MAIL TO PROVIDER

            //Get the email's TO address
            message = new MailMessage();

            //Get the email's FROM address from Web.conf
            message.From = new MailAddress(LACESUtilities.GetAdminFromEmail());

            message.To.Add(new MailAddress(receiverEmail, receiverName));

            message.CC.Add(new MailAddress("*****@*****.**", "*****@*****.**"));
            //message.CC.Add(new MailAddress("*****@*****.**", "*****@*****.**"));

            //Get the email's Subject
            message.Subject = "Your LA CES Transaction Has Been Processed";

            //Whether the message body would be displayed as html or not
            message.IsBodyHtml = true;

            //Get the email's BODY
            message.Body = "Dear " + HttpUtility.HtmlEncode(receiverName) + ",<br /><br />Your LA CES transaction of $295.00 was charged to your credit card on " + System.DateTime.Today.ToShortDateString() + ". Please print this e-mail and keep as a receipt for your records.<br/><br/>Thank you,<br/><br/>LA CES<br/>[email protected]";


            //Send the mail to provider
            if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y")
            {
                smtpClient.Send(message);
            }
        }
        catch (Exception exp)
        {
        }
    }