コード例 #1
0
        private void SendPackageAlert(WorkingUser warehouseStaff, PackageEmailModel packageEmailModel)
        {
            var templatePath   = HostingEnvironment.MapPath("~/App_Data/EmailTemplates/PackageEmail.cshtml");
            var content        = File.ReadAllText(templatePath);
            var uri            = HttpContext.Current.Request.Url;
            var currentHostUrl = uri.Scheme + Uri.SchemeDelimiter + uri.Host + ":" + uri.Port;

            foreach (var email in packageEmailModel.Emails)
            {
                var bodyContent = Razor.Parse(content, new
                {
                    ReceiverName   = email.Name,
                    SenderName     = warehouseStaff.FullName,
                    Content        = packageEmailModel.Comment,
                    Host           = currentHostUrl,
                    IsPackagedFull = packageEmailModel.IsFull ? "Yes" : "No",
                    packageEmailModel.DepartmentName,
                    packageEmailModel.LocationName
                });
                _emailDelivery.Send("Staffpurchase - Package Alert Message", bodyContent, email.Email, "");
            }
        }
コード例 #2
0
        public HttpResponseMessage TestEmailTo([FromUri] string to)
        {
            _emailDelivery.Send("test", "test", to, _appSettings.SmtpClientEmailFrom);

            return(Request.CreateResponse());
        }