Example #1
0
        /// <summary>
        /// Returns a report in html format.
        /// </summary>
        /// <returns></returns>
        public MailInformation GetHtmlReport()
        {
            string subject = string.Format("Mail Sender Log, mail sent between {0} and {1}", this.SendStart, this.SendStop);
            string from    = NewsLetterConfiguration.GetAppSettingsConfigValueEx <string>("EPsSendMailSendReportMailTo", null);

            return(GetHtmlReport(subject, from));
        }
Example #2
0
 protected SendGridSettings GetSettings()
 {
     return(new SendGridSettings
     {
         ApiKey = NewsLetterConfiguration.GetAppSettingsConfigValueEx <string>("Newsletter.SendGrid.ApiKey", "")
     });
 }
Example #3
0
        /// <summary>
        /// Gets the sender email address.
        /// </summary>
        /// <remarks>
        /// 1. Use MailSender property
        /// 2. Use Newsletter.DefaultFromAddress from appSettings
        /// 3. Construct noreply@SiteUrl
        /// </remarks>
        /// <param name="page">The page to extract information from.</param>
        /// <returns></returns>
        public virtual string GetMailSender(PageData page)
        {
            string fromAddress = null;

            if (page["MailSender"] != null)
            {
                fromAddress = page["MailSender"].ToString();
            }
            else
            {
                fromAddress = NewsLetterConfiguration.GetAppSettingsConfigValueEx <string>("Newsletter.DefaultFromAddress", "noreply@" + SiteDefinition.Current.SiteUrl.Host);
            }
            return(fromAddress);
        }
        /// <summary>
        /// Gets the local license file path. Should not start with
        /// a back slash as it will be prepended along with the rest
        /// of the local path.
        /// </summary>
        /// <remarks>
        /// Default value is:
        /// "bvn\sendmail\license\aspNetEmail.xml.lic"
        /// </remarks>
        /// <returns>The root relative path (not URL) to the license xml file.</returns>
        private string GetLocalLicenseFilePath()
        {
            string localFile = null;
            // Should be of type:
            // bvn\sendmail\license\aspNetEmail.xml.lic (default)
            string nonStandardLicensePath = NewsLetterConfiguration.GetAppSettingsConfigValueEx <string>("EPsAspNetEmailRelativeLicensePath", null);

            if (string.IsNullOrEmpty(nonStandardLicensePath) == false)
            {
                localFile = EPiServer.Global.BaseDirectory + nonStandardLicensePath;
            }
            else
            {
                localFile = EPiServer.Global.BaseDirectory + REL_LICENSE_PATH;
            }

            return(localFile);
        }
Example #5
0
        /// <summary>
        /// Gets the mail subject.
        /// </summary>
        /// <remarks>
        /// 1. Use MailSubject property
        /// 2. Use PageName
        /// 2. Use Newsletter.DefaultMailSubject from appSetting
        /// 3. Use "Newsletter" as default
        /// </remarks>
        public virtual string GetMailSubject(PageData page)
        {
            string subject = null;

            if (page != null)
            {
                if (page["MailSubject"] != null)
                {
                    subject = page["MailSubject"].ToString();
                }

                if (subject == null)
                {
                    subject = page.PageName;
                }
            }

            if (subject == null)
            {
                subject = NewsLetterConfiguration.GetAppSettingsConfigValueEx <string>("Newsletter.DefaultMailSubject", "Newsletter");
            }

            return(subject);
        }