SendMail() 공개 정적인 메소드

Send Text Mail
public static SendMail ( string Sender, string SenderName, string Receiver, string CC, string BCC, string Body, string subject ) : void
Sender string string Sender
SenderName string
Receiver string string Receiver
CC string string CC
BCC string string BCC
Body string string body
subject string string subject
리턴 void
        public int SendNewServiceRequestSiteOwnerNotification(string EmailAddress, string ZipCode)
        {
            string mailBody = System.IO.File.ReadAllText(_webHelper.MapPath("~/EmailTemplates/NewServiceRequestSiteOwnerNotification.htm"));


            mailBody = mailBody.Replace("%friendname%", EmailAddress);
            mailBody = mailBody.Replace("%yourname%", ZipCode);
            mailBody = mailBody.Replace("%siteurl%", _siteSetting.SiteUrl);

            EmailAccess.SendMail(_siteSetting.SenderEmail, _siteSetting.SenderName, _siteSetting.SenderEmail, "", _siteSetting.BCCEmail, mailBody, "Eric's Gutter Cleaning - New Service Request!");

            return(1);
        }
        public int SendReferANeighborMessage(string FriendName, string FriendEmail, string YourName)
        {
            string mailBody = System.IO.File.ReadAllText(_webHelper.MapPath("~/EmailTemplates/SendReferANeighborNotification.htm"));


            mailBody = mailBody.Replace("%friendname%", FriendName);
            mailBody = mailBody.Replace("%yourname%", YourName);
            mailBody = mailBody.Replace("%siteurl%", _siteSetting.SiteUrl);

            EmailAccess.SendMail(_siteSetting.SenderEmail, _siteSetting.SenderName, FriendEmail, "", _siteSetting.BCCEmail, mailBody, "Refer A Neighbor - Eric's Gutter Cleaning Service");

            return(1);
        }
        public int SendOrderPlacedSiteOwnerNotification(GutterCleanOrder order)
        {
            string mailBody = System.IO.File.ReadAllText(_webHelper.MapPath("~/EmailTemplates/OrderPlacedSiteOwnerNotification.htm"));

            string OrderURLForCustomer = string.Format("{0}order-details/{1}", GetSiteUrl(),
                                                       order.Id);

            var zipcodedetail = _zipCodeService.GetZipCodeDetailByZipcode(order.Zipcode);
            var r             = _questionAnswerEntityDataService.StyleOfGuttersAnswer().Where(i => i.Value == order.QuestionStyleOfGutter).SingleOrDefault();
            var year          = _questionAnswerEntityDataService.YearBuiltAnswer().Where(i => i.Value == order.QuestionYearBuilt.ToString()).SingleOrDefault();



            mailBody = mailBody.Replace("%Order.OrderURLForCustomer%", OrderURLForCustomer);

            mailBody = mailBody.Replace("%username%", order.Customer.Email);
            mailBody = mailBody.Replace("%customerfullname%", order.Customer.FirstName + " " + order.Customer.LastName);
            mailBody = mailBody.Replace("%customeremail%", order.Customer.Email);

            mailBody = mailBody.Replace("%orderid%", order.Id.ToString());
            mailBody = mailBody.Replace("%orderidURL%", _siteSetting.SiteUrl + "Admin/GutterOrder/OrderDetail?orderId=" + order.Id.ToString());
            mailBody = mailBody.Replace("%createddate%", _dateTimeHelper.ConvertToUserTime(order.CreatedOnUtc, DateTimeKind.Utc).ToString());
            mailBody = mailBody.Replace("%completiondate%", "");
            mailBody = mailBody.Replace("%ordertotal%", string.Format("{0:C}", order.OrderTotal));


            mailBody = mailBody.Replace("%street%", order.Address);
            if (zipcodedetail != null)
            {
                mailBody = mailBody.Replace("%citystate%", zipcodedetail.CityName + ", " + zipcodedetail.StateName);
            }
            else
            {
                mailBody = mailBody.Replace("%citystate%", "");
            }
            mailBody = mailBody.Replace("%zipcode%", order.Zipcode);


            mailBody = mailBody.Replace("%squarefootage%", order.QuestionSquareFootage.ToString());
            mailBody = mailBody.Replace("%styleofgutters%", r.Text);
            mailBody = mailBody.Replace("%yearbuilt%", year.Text);
            mailBody = mailBody.Replace("%roofmaterial%", order.RoofMaterial);

            mailBody = mailBody.Replace("%siteurl%", _siteSetting.SiteUrl);


            EmailAccess.SendMail(_siteSetting.SenderEmail, _siteSetting.SenderName, _siteSetting.AdminEmail, "*****@*****.**", _siteSetting.BCCEmail, mailBody, "NEW Order #: " + order.Id.ToString());

            return(1);
        }
        public int SendCustomerPasswordRecoveryMessage(Customer customer)
        {
            string mailBody = System.IO.File.ReadAllText(_webHelper.MapPath("~/EmailTemplates/CustomerPasswordRecoveryMessage.htm"));

            string passwordRecoveryUrl = string.Format("{0}resetpassword?token={1}&email={2}", GetSiteUrl(), customer.PasswordRecoveryToken, HttpUtility.UrlEncode(customer.Email));

            mailBody = mailBody.Replace("%PasswordRecoveryURL%", passwordRecoveryUrl);
            mailBody = mailBody.Replace("%customerfullname%", customer.FirstName + " " + customer.LastName);
            mailBody = mailBody.Replace("%customeremail%", customer.Email);
            mailBody = mailBody.Replace("%siteurl%", _siteSetting.SiteUrl);


            EmailAccess.SendMail(_siteSetting.SenderEmail, _siteSetting.SenderName, customer.Email, "", _siteSetting.BCCEmail, mailBody, "Eric's Gutter Cleaning Password Reset");

            return(1);
        }
        public int SendContactUsMessage(ContactU contactUs)
        {
            string mailBody = System.IO.File.ReadAllText(_webHelper.MapPath("~/EmailTemplates/CustomerContactUs.htm"));


            mailBody = mailBody.Replace("%contactname%", contactUs.FirstName + " " + contactUs.LastName);
            mailBody = mailBody.Replace("%phoneno%", contactUs.PhoneNo);
            mailBody = mailBody.Replace("%email%", contactUs.Email);
            mailBody = mailBody.Replace("%message%", contactUs.Message);
            mailBody = mailBody.Replace("%siteurl%", _siteSetting.SiteUrl);

            var BCC = _siteSetting.BCCEmail;

            //if (!_siteSetting.SenderName.Contains("Test"))
            //{
            //  BCC = BCC + ",[email protected]";
            //}
            EmailAccess.SendMail(_siteSetting.SenderEmail, _siteSetting.SenderName, contactUs.Email, "*****@*****.**", _siteSetting.BCCEmail, mailBody, " Eric's Gutter Cleaning - Thank you for contacting us!");

            return(1);
        }