コード例 #1
0
 private string generateEmailBody(string template, ShareModel model)
 {
     try
     {
         return Razor.Parse(template, model);
     }
     catch (Exception ex)
     {
         logAccessor.CreateLog(DateTime.Now, this.GetType().ToString() + "." + System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), ex.ToString());
         return ex.Message;
     }
 }
コード例 #2
0
        public bool SendShareEmail(string link, string email, string senderName)
        {
            try
            {
                ShareModel shareModel = new ShareModel()
                {
                    Name = senderName,
                    Link = link
                };

                String messageBody = generateEmailBody(Manager.Properties.Resources.ShareTemplate.ToString(), shareModel);

                SendMessage("*****@*****.**", "*****@*****.**", new String[1] { email }, null, null, "Someone wants to share their Vestn profile with you!", messageBody);

                return true;
            }
            catch (Exception e)
            {
                logAccessor.CreateLog(DateTime.Now, this.GetType().ToString() + "." + System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), e.ToString());
                return false;
            }
        }