Exemple #1
0
        public static bool SendJustActivated(Data_AppUserFile user, LogForEmailSend log)
        {
            try
            {
                string to      = user.Email;
                string subject = "Register with NiceApi.net";

                Assembly assembly         = Assembly.GetExecutingAssembly();
                string   htmlBodyNoHeader = new StreamReader(assembly.GetManifestResourceStream("NiceApiLibrary.Embedded.JustActivated.txt")).ReadToEnd();
                htmlBodyNoHeader = htmlBodyNoHeader
                                   .Replace("{Name}", System.Web.HttpUtility.HtmlEncode(user.UserName))
                                   .Replace("{Email}", System.Web.HttpUtility.HtmlEncode(user.Email))
                                   .Replace("{Password}", System.Web.HttpUtility.HtmlEncode(user.Password))
                                   .Replace("{APIId}", System.Web.HttpUtility.HtmlEncode(user.ApiGuId))
                                   .Replace("{Mobile1}", System.Web.HttpUtility.HtmlEncode(user.MobileNumberX(0)))
                                   .Replace("{Mobile2}", System.Web.HttpUtility.HtmlEncode(user.MobileNumberX(1)))
                                   .Replace("{Mobile3}", System.Web.HttpUtility.HtmlEncode(user.MobileNumberX(2)))
                                   .Replace("{Mobile4}", System.Web.HttpUtility.HtmlEncode(user.MobileNumberX(3)))
                                   .Replace("{Mobile5}", System.Web.HttpUtility.HtmlEncode(user.MobileNumberX(4)));

                string error;

                return(Send(EMailCredentials.GetSupport(), to, subject, htmlBodyNoHeader, out error, log, "JustActivated"));
            }
            catch (SystemException)
            {
            }
            return(false);
        }
Exemple #2
0
        public static bool SendGeneralEmail(
            string toEmail,
            bool sendCopyToAdmin,
            string subject,
            string htmlBodyNoHeader,
            LogForEmailSend log)
        {
            try
            {
                string error;

                return(Send(
                           EMailCredentials.GetSupport(),
                           toEmail,
                           sendCopyToAdmin ? throw new NotImplementedException("not suitable for publication!") : (string)null,
                           subject,
                           htmlBodyNoHeader,
                           out error,
                           log,
                           subject));
            }
            catch (SystemException ex)
            {
                log.Log.Error("SystemException: " + ex.Message);
            }
            return(false);
        }
Exemple #3
0
        public static string SendTestMail(LogForEmailSend log)
        {
            string to      = throw new NotImplementedException("not suitable for publication!");
            string subject = "Test Mail";
            string error;

            if (Send(EMailCredentials.GetSupport(), to, subject, "htmlBodyNoHeader", out error, log, "TestMail"))
            {
                return("OK");
            }
            return(error);
        }
Exemple #4
0
 public static bool SendAdminNotification(string htmlBodyNoHeader, LogForEmailSend log)
 {
     try
     {
         string to      = throw new NotImplementedException("not suitable for publication!");
         string subject = "AdminNotification NiceApi.net";
         string error;
         return(Send(EMailCredentials.GetSupport(), to, subject, htmlBodyNoHeader, out error, log, "AdminNotification"));
     }
     catch (SystemException)
     {
     }
     return(false);
 }
Exemple #5
0
        public static bool SendRegisterActivation(Data_AppUserFile user, LogForEmailSend log)
        {
            try
            {
                string to               = user.Email;
                string subject          = "Register with NiceApi.net";
                string htmlBodyNoHeader = EMail_Data.GetRegistrationEmailBody("https://NiceApi.net/Register?ApiGuId=" + Base64_URLEncoding(user.ApiGuId));
                string error;

                bool ret = Send(EMailCredentials.GetSupport(), to, subject, htmlBodyNoHeader, out error, log, "Verify Please");
                return(ret);
            }
            catch (SystemException)
            {
            }
            return(false);
        }
Exemple #6
0
        public static bool SendWrongTelRegistered(Data_AppUserFile user, LogForEmailSend log)
        {
            try
            {
                string to      = user.Email;
                string subject = "Your registration with with NiceApi.net";

                Assembly assembly         = Assembly.GetExecutingAssembly();
                string   htmlBodyNoHeader = new StreamReader(assembly.GetManifestResourceStream("NiceApiLibrary.Embedded.Reg_TelWrong_EmailText.txt")).ReadToEnd();
                htmlBodyNoHeader = doFieldReplacement(htmlBodyNoHeader, user);

                string error;

                return(Send(EMailCredentials.GetSupport(), to, subject, htmlBodyNoHeader, out error, log, "WrongTelRegistered"));
            }
            catch (SystemException)
            {
            }
            return(false);
        }
Exemple #7
0
        public static bool SendUpgrade032018(Data_AppUserFile user, LogForEmailSend log)
        {
            try
            {
                string to      = user.Email;
                string subject = "Hardware upgrade";

                Assembly assembly         = Assembly.GetExecutingAssembly();
                string   htmlBodyNoHeader = new StreamReader(assembly.GetManifestResourceStream("NiceApiLibrary.Embedded.ServerMove032018EmialText.txt")).ReadToEnd();
                htmlBodyNoHeader = doFieldReplacement(htmlBodyNoHeader, user);

                string error;

                return(Send(EMailCredentials.GetSupport(), to, subject, htmlBodyNoHeader, out error, log, "Upgrade032018"));
            }
            catch (SystemException)
            {
            }
            return(false);
        }
Exemple #8
0
        public static bool SendUpgradeRequestOnHighPercent(Data_AppUserFile user, LogForEmailSend log)
        {
            try
            {
                string to      = user.Email;
                string subject = "Your account usage";

                Assembly assembly         = Assembly.GetExecutingAssembly();
                string   htmlBodyNoHeader = new StreamReader(assembly.GetManifestResourceStream("NiceApiLibrary.Embedded.UpgradeEmail.txt")).ReadToEnd();
                htmlBodyNoHeader = doFieldReplacement(htmlBodyNoHeader, user);

                string error;

                return(Send(EMailCredentials.GetSupport(), to, subject, htmlBodyNoHeader, out error, log, subject));
            }
            catch (SystemException)
            {
            }
            return(false);
        }