コード例 #1
0
ファイル: EmailMgr.cs プロジェクト: wjkong/OnlineStore.API
        public bool SendPwdChangeNotifyEmail(User info)
        {
            StringBuilder builder = new StringBuilder("<html><body>");
            builder.Append("<p>Thank you for your request.</p>");
            builder.Append("<p>Temparory Password: "******"</p>");
            builder.Append(string.Format("<p>Login to <a href='{0}/#/login'>Online Store Login</a></p>", Utility.BASE_URL));
            builder.Append("</body></html>");

            var emailInfo = new Email();

            emailInfo.From = ConfigurationManager.AppSettings.Get("DefaultEmail");
            emailInfo.Subject = "Online Store - Password Recovery";
            emailInfo.Body = builder.ToString();
            emailInfo.To = info.Email;

            return Send(emailInfo);
        }
コード例 #2
0
ファイル: EmailMgr.cs プロジェクト: wjkong/OnlineStore.API
        public bool Send(Email info)
        {
            MailMessage message = null;

            try
            {
                message = new MailMessage();
                message.IsBodyHtml = true;
                message.From = new MailAddress(info.From);
                message.To.Add(new MailAddress(info.To));
                message.Subject = info.Subject;
                message.Body = info.Body;

                string host = ConfigurationManager.AppSettings["SmtpHost"];
                string username = ConfigurationManager.AppSettings["SmtpUsername"];
                string password = ConfigurationManager.AppSettings["SmtpPassword"];

                SmtpClient client = new SmtpClient
                {
                    Port = 25,
                    DeliveryMethod = SmtpDeliveryMethod.Network,
                    UseDefaultCredentials = false,
                    Host = host,
                    Credentials = new NetworkCredential(username, password)
                };

                //client.EnableSsl = true;
                client.Send(message);

                return true;
            }
            catch
            {
                return false;
            }
        }
コード例 #3
0
ファイル: EmailMgr.cs プロジェクト: wjkong/OnlineStore.API
        public bool SendRegConfirmEmail(User info)
        {
            StringBuilder builder = new StringBuilder("<html><body>");
            builder.Append("<p>Thank you for registering with EStore.</p>");
            builder.Append("");
            builder.Append("<p>Please click the following link to login to your account ");
            builder.Append(string.Format("<a href='{0}/#/login'>Online Store Login</a></p>", Utility.BASE_URL));
            builder.Append("</body></html>");

            var emailInfo = new Email();

            emailInfo.From = ConfigurationManager.AppSettings.Get("DefaultEmail");
            emailInfo.Subject = "Online Store - Registration Confirmation";
            emailInfo.Body = builder.ToString();
            emailInfo.To = info.Email;

            return Send(emailInfo);
        }