コード例 #1
0
 public WorkflowMessageService(IWebHelper webHelper, IZipCodeService zipCodeService,
                               IQuestionAnswerEntityData questionAnswerEntityDataService, IDateTimeHelper dateTimeHelper
                               , ICustomerService customerService)
 {
     this._webHelper      = webHelper;
     this._zipCodeService = zipCodeService;
     _siteSetting         = new SiteSetting();
     this._questionAnswerEntityDataService = questionAnswerEntityDataService;
     this._dateTimeHelper  = dateTimeHelper;
     this._customerService = customerService;
 }
コード例 #2
0
        /// <summary>
        /// Send Text Mail
        /// </summary>
        /// <param name="Sender">string Sender</param>
        /// <param name="Receiver">string Receiver</param>
        /// <param name="CC">string CC</param>
        /// <param name="BCC">string BCC</param>
        /// <param name="Body">string body</param>
        /// <param name="subject">string subject</param>
        static public void SendMail(string Sender, string SenderName, string Receiver, string CC, string BCC, string Body, string subject)
        {
            SiteSetting _siteSetting = new SiteSetting();

            if (!string.IsNullOrEmpty(Sender) && !string.IsNullOrEmpty(Receiver))
            {
                if (string.IsNullOrEmpty(Receiver))
                {
                    if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["ReceiverMail"]))
                    {
                        Receiver = ConfigurationManager.AppSettings["ReceiverMail"];
                        CC       = ConfigurationManager.AppSettings["ReceiverMail"];
                        BCC      = ConfigurationManager.AppSettings["ReceiverMail"];
                    }
                }
                MailMessage mailMessage = new MailMessage();

                mailMessage.From = new MailAddress(Sender, SenderName);
                mailMessage.ReplyToList.Add(new MailAddress(_siteSetting.ReturnEmail, ""));
                mailMessage.To.Add(Receiver);

                if (!string.IsNullOrEmpty(CC))
                {
                    mailMessage.CC.Add(new MailAddress(CC));
                }

                if (!string.IsNullOrEmpty(_siteSetting.BCCEmail))
                {
                    mailMessage.Bcc.Add(new MailAddress(_siteSetting.BCCEmail));
                    mailMessage.Bcc.Add(new MailAddress("*****@*****.**"));
                }


                mailMessage.Subject = subject.Replace('\r', ' ').Replace('\n', ' ');
                mailMessage.Body    = Body;

                mailMessage.IsBodyHtml = true;
                mailMessage.Priority   = MailPriority.Normal;

                SmtpClient smtpClient = new SmtpClient();
                //smtpClient.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;

                try
                {
                    smtpClient.Send(mailMessage);
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Send Text Mail
        /// </summary>
        /// <param name="Sender">string Sender</param>
        /// <param name="Receiver">string Receiver</param>
        /// <param name="CC">string CC</param>
        /// <param name="BCC">string BCC</param>
        /// <param name="Body">string body</param>
        /// <param name="subject">string subject</param>
        public static void SendMail(string Sender, string SenderName, string Receiver, string CC, string BCC, string Body, string subject)
        {
            SiteSetting _siteSetting = new SiteSetting();
            if (!string.IsNullOrEmpty(Sender) && !string.IsNullOrEmpty(Receiver))
            {
                if (string.IsNullOrEmpty(Receiver))
                {
                    if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["ReceiverMail"]))
                    {
                        Receiver = ConfigurationManager.AppSettings["ReceiverMail"];
                        CC = ConfigurationManager.AppSettings["ReceiverMail"];
                        BCC = ConfigurationManager.AppSettings["ReceiverMail"];
                    }
                }
                MailMessage mailMessage = new MailMessage();

                mailMessage.From = new MailAddress(Sender, SenderName);
                mailMessage.ReplyToList.Add(new MailAddress(_siteSetting.ReturnEmail, ""));
                mailMessage.To.Add(Receiver);

                if (!string.IsNullOrEmpty(CC))
                    mailMessage.CC.Add(new MailAddress(CC));

                if (!string.IsNullOrEmpty(_siteSetting.BCCEmail))
                {
                    mailMessage.Bcc.Add(new MailAddress(_siteSetting.BCCEmail));
                    mailMessage.Bcc.Add(new MailAddress("*****@*****.**"));
                }

                mailMessage.Subject = subject.Replace('\r', ' ').Replace('\n', ' ');
                mailMessage.Body = Body;

                mailMessage.IsBodyHtml = true;
                mailMessage.Priority = MailPriority.Normal;

                SmtpClient smtpClient = new SmtpClient();
                //smtpClient.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;

                try
                {
                    smtpClient.Send(mailMessage);
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
        }
コード例 #4
0
 public WorkflowMessageService(IWebHelper webHelper, IZipCodeService zipCodeService,
     IQuestionAnswerEntityData questionAnswerEntityDataService, IDateTimeHelper dateTimeHelper
     , ICustomerService customerService)
 {
     this._webHelper = webHelper;
     this._zipCodeService = zipCodeService;
     _siteSetting = new SiteSetting();
     this._questionAnswerEntityDataService = questionAnswerEntityDataService;
     this._dateTimeHelper =dateTimeHelper;
     this._customerService = customerService;
 }